uvt: client: fix double-kill by first unlinkink then resetting
authorDavid Herrmann <dh.herrmann@gmail.com>
Tue, 5 Mar 2013 17:00:50 +0000 (18:00 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Tue, 5 Mar 2013 17:00:50 +0000 (18:00 +0100)
We _must_ unlink the client and cdev first, then reset the VT. Otherwise,
the set_vt() call might think we are still alive and call user-defined
callbacks which might call kill again.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
src/uvt_client.c

index fcacfc0..1735673 100644 (file)
@@ -405,10 +405,10 @@ void uvt_client_kill(struct uvt_client *client)
                client->ph = NULL;
        }
 
-       uvt_client_set_vt(client, NULL, NULL);
-       uvt_client_waiters_release(client, -EPIPE);
        shl_dlist_unlink(&client->list);
        client->cdev = NULL;
+       uvt_client_set_vt(client, NULL, NULL);
+       uvt_client_waiters_release(client, -EPIPE);
 }
 
 /*