diff --git a/dbus/dbus-mainloop.c b/dbus/dbus-mainloop.c index 03e9d1c1..a25b31d6 100644 --- a/dbus/dbus-mainloop.c +++ b/dbus/dbus-mainloop.c @@ -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) { diff --git a/dbus/dbus-watch.c b/dbus/dbus-watch.c index 8d759e5e..f4a5820e 100644 --- a/dbus/dbus-watch.c +++ b/dbus/dbus-watch.c @@ -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)