]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Revert "[event-loop] Don't crash by running removed timeouts"
authorRay Strode <rstrode@redhat.com>
Wed, 18 Nov 2009 21:24:23 +0000 (16:24 -0500)
committerRay Strode <rstrode@redhat.com>
Wed, 18 Nov 2009 21:24:23 +0000 (16:24 -0500)
This reverts commit 79baa323e61b4c8a0e7bf75c773e78094ebf27fa.

It wasn't really the right way to fix the original problem.

Now we end up in a case where timeouts can still run after
stop_watching_for_timeout is called on them.  This can cause
crashes.

We need to instead fix the problem in a different way.

src/libply/ply-event-loop.c

index 742807b110bb735ab95ac60709141016cf88845d..d8d3a98c0f6fcd0440e6c2180395a4ef22f6cc36 100644 (file)
@@ -1177,7 +1177,6 @@ ply_event_loop_disconnect_source (ply_event_loop_t           *loop,
 static void
 ply_event_loop_handle_timeouts (ply_event_loop_t *loop)
 {
-  ply_list_t *watches_to_dispatch;
   ply_list_node_t *node;
   double now;
 
@@ -1185,8 +1184,6 @@ ply_event_loop_handle_timeouts (ply_event_loop_t *loop)
 
   now = ply_get_timestamp ();
   node = ply_list_get_first_node (loop->timeout_watches);
-
-  watches_to_dispatch = ply_list_new ();
   loop->wakeup_time = PLY_EVENT_LOOP_NO_TIMED_WAKEUP;
   while (node != NULL)
     {
@@ -1199,7 +1196,8 @@ ply_event_loop_handle_timeouts (ply_event_loop_t *loop)
       if (watch->timeout <= now)
         {
           assert (watch->handler != NULL);
-          ply_list_append_data (watches_to_dispatch, watch);
+          watch->handler (watch->user_data, loop);
+          free (watch);
           ply_list_remove_node (loop->timeout_watches, node);
         }
       else {
@@ -1212,23 +1210,6 @@ ply_event_loop_handle_timeouts (ply_event_loop_t *loop)
       node = next_node;
     }
 
-  node = ply_list_get_first_node (watches_to_dispatch);
-  while (node != NULL)
-    {
-      ply_list_node_t *next_node;
-      ply_event_loop_timeout_watch_t *watch;
-
-      watch = (ply_event_loop_timeout_watch_t *) ply_list_node_get_data (node);
-      next_node = ply_list_get_next_node (loop->timeout_watches, node);
-
-      watch->handler (watch->user_data, loop);
-      free (watch);
-
-      node = next_node;
-    }
-
-  ply_list_free (watches_to_dispatch);
-
 }
 
 void