Check that watches are removed, then invalidated, then unreffed

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>
This commit is contained in:
Simon McVittie 2011-01-21 16:49:14 +00:00
parent 58f968a2cc
commit c5c7850762
2 changed files with 8 additions and 1 deletions

View 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)
{

View 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)