Ticket #520: Race condition may cause ioqueue corruption (thanks Philippe Leuba)

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1905 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/src/pj/ioqueue_select.c b/pjlib/src/pj/ioqueue_select.c
index 0d90789..fdd0d9b 100644
--- a/pjlib/src/pj/ioqueue_select.c
+++ b/pjlib/src/pj/ioqueue_select.c
@@ -445,7 +445,10 @@
 
     pj_assert(ioqueue->count > 0);
     --ioqueue->count;
+#if !PJ_IOQUEUE_HAS_SAFE_UNREG
+    /* Ticket #520, key will be erased more than once */
     pj_list_erase(key);
+#endif
     PJ_FD_CLR(key->fd, &ioqueue->rfdset);
     PJ_FD_CLR(key->fd, &ioqueue->wfdset);
 #if PJ_HAS_TCP