]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[event-loop] Remove pending timeout before dispatching
authorRay Strode <rstrode@redhat.com>
Wed, 18 Nov 2009 21:26:03 +0000 (16:26 -0500)
committerRay Strode <rstrode@redhat.com>
Wed, 18 Nov 2009 21:26:03 +0000 (16:26 -0500)
This way if the timeout handler removes itself, we don't
double-free and crash.  This is a better fix for

commit 79baa323e61b4c8a0e7bf75c773e78094ebf27fa

src/libply/ply-event-loop.c

index d8d3a98c0f6fcd0440e6c2180395a4ef22f6cc36..476b116f30fd27bc3b704b3ee59d761d8ccd0a8e 100644 (file)
@@ -1196,11 +1196,14 @@ ply_event_loop_handle_timeouts (ply_event_loop_t *loop)
       if (watch->timeout <= now)
         {
           assert (watch->handler != NULL);
+
+          ply_list_remove_node (loop->timeout_watches, node);
+
           watch->handler (watch->user_data, loop);
           free (watch);
-          ply_list_remove_node (loop->timeout_watches, node);
         }
-      else {
+      else
+        {
           if (fabs (loop->wakeup_time - PLY_EVENT_LOOP_NO_TIMED_WAKEUP) <= 0)
             loop->wakeup_time = watch->timeout;
           else