Andreas Beck <[EMAIL PROTECTED]> wrote:
> Ooops - seems like I opened a can of worms here ...

Second try:

Patch as before plus:

Obviosly we should not bail out even on a bogus request with
locks retained:
@@ -843,14 +849,13 @@
                      individual origin. */
 
        if (inp == NULL) return GGI_EARGINVAL;
+       if (inp->next == inp) return GGI_ENOTFOUND;
 
        if (_gii_threadsafe) {
                ggLock(inp->mutex);
                ggLock(inp->queue->mutex);
        }
 
-       if (inp->next == inp) return GGI_ENOTFOUND;
-
        idx = inp;
        do {
                if ((origin == idx->origin) || 


and we seem to miss to re-free the queue here 
@@ -883,7 +888,10 @@
                                }
                                inp->next = inp;
                                inp->prev = inp;
-                               if (_gii_threadsafe) ggUnlock(inp->mutex);
+                               if (_gii_threadsafe) {
+                                       ggUnlock(inp->queue->mutex);
+                                       ggUnlock(inp->mutex);
+                               }
                                /* newhand may still be a joined input,
                                 * so we inform the user of that. */
                                return 1;

The "straight" case seems to handle that right.

Fix works for me. I can now dynamically create and destroy "views".

Shall I commit ? (I hate to fix things the wrong way, so I rather ask one 
time too much ...)


CU, Andy

-- 
Andreas Beck             |  Email :  <[EMAIL PROTECTED]>

Reply via email to