]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Don't try to remove watches that have already been removed
authorRay Strode <rstrode@redhat.com>
Thu, 7 Aug 2008 02:22:55 +0000 (22:22 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 7 Aug 2008 02:22:55 +0000 (22:22 -0400)
This prevents some assertions from getting thrown by the
client under some circumstances

src/client/ply-boot-client.c

index 7604e2745b1024a0f1f7d1da9ffb2e3261b251aa..b0c444ddf55c9e06043e2082e3a0fe76bd85b2c4 100644 (file)
@@ -104,9 +104,14 @@ ply_boot_client_cancel_unsent_requests (ply_boot_client_t *client)
       node = next_node;
     }
 
-  ply_event_loop_stop_watching_fd (client->loop, 
-                                   client->daemon_can_take_request_watch);
-  client->daemon_can_take_request_watch = NULL;
+  if (client->daemon_can_take_request_watch != NULL)
+    {
+      assert (client->loop != NULL);
+
+      ply_event_loop_stop_watching_fd (client->loop, 
+                                       client->daemon_can_take_request_watch);
+      client->daemon_can_take_request_watch = NULL;
+    }
 }
 
 static void
@@ -132,9 +137,14 @@ ply_boot_client_cancel_requests_waiting_for_replies (ply_boot_client_t *client)
       node = next_node;
     }
 
-  ply_event_loop_stop_watching_fd (client->loop, 
-                                   client->daemon_has_reply_watch);
-  client->daemon_has_reply_watch = NULL;
+  if (client->daemon_has_reply_watch != NULL)
+    {
+      assert (client->loop != NULL);
+
+      ply_event_loop_stop_watching_fd (client->loop, 
+                                       client->daemon_has_reply_watch);
+      client->daemon_has_reply_watch = NULL;
+    }
 }
 
 static void
@@ -288,9 +298,13 @@ out:
 
   if (ply_list_get_length (client->requests_waiting_for_replies) == 0)
     {
-      ply_event_loop_stop_watching_fd (client->loop,
-                                       client->daemon_has_reply_watch);
-      client->daemon_has_reply_watch = NULL;
+      if (client->daemon_has_reply_watch != NULL)
+        {
+          assert (client->loop != NULL);
+          ply_event_loop_stop_watching_fd (client->loop,
+                                           client->daemon_has_reply_watch);
+          client->daemon_has_reply_watch = NULL;
+        }
     }
 }
 
@@ -379,9 +393,14 @@ ply_boot_client_process_pending_requests (ply_boot_client_t *client)
 
   if (ply_list_get_length (client->requests_to_send) == 0)
     {
-      ply_event_loop_stop_watching_fd (client->loop,
-                                       client->daemon_can_take_request_watch);
-      client->daemon_can_take_request_watch = NULL;
+      if (client->daemon_has_reply_watch != NULL)
+        {
+          assert (client->loop != NULL);
+
+          ply_event_loop_stop_watching_fd (client->loop,
+                                           client->daemon_can_take_request_watch);
+          client->daemon_can_take_request_watch = NULL;
+        }
     }
 }
 
@@ -534,7 +553,10 @@ static void
 ply_boot_client_detach_from_event_loop (ply_boot_client_t *client)
 {
   assert (client != NULL);
+  ply_trace ("detaching from event loop");
   client->loop = NULL;
+  client->daemon_can_take_request_watch = NULL;
+  client->daemon_has_reply_watch = NULL;
 }
 
 static void