]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Check that watches are removed, then invalidated, then unreffed
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 21 Jan 2011 16:49:14 +0000 (16:49 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 13 Jun 2011 14:48:50 +0000 (15:48 +0100)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
dbus/dbus-mainloop.c
dbus/dbus-watch.c

index 03e9d1c18fb5e1df44b9c996ad23a7da21663590..a25b31d6059564fcbd4df4cf88be01a96241bfd9 100644 (file)
@@ -290,7 +290,11 @@ _dbus_loop_remove_watch (DBusLoop          *loop,
                          void             *data)
 {
   DBusList *link;
-  
+
+  /* fd.o #33336: we want people to remove their watches before invalidating
+   * them */
+  _dbus_assert (dbus_watch_get_socket (watch) != -1);
+
   link = _dbus_list_get_first_link (&loop->callbacks);
   while (link != NULL)
     {
index 8d759e5e36df71b27a4aebc9f3518617ee497821..f4a5820eec547d1e2644214e696edda8462e7305 100644 (file)
@@ -129,6 +129,9 @@ _dbus_watch_unref (DBusWatch *watch)
   watch->refcount -= 1;
   if (watch->refcount == 0)
     {
+      if (watch->fd != -1)
+        _dbus_warn ("this watch should have been invalidated");
+
       dbus_watch_set_data (watch, NULL, NULL); /* call free_data_function */
 
       if (watch->free_handler_data_function)