doc: Remove methods to lookup and connect services
[framework/connectivity/connman.git] / gdbus / watch.c
index e7c203a..fba58c3 100644 (file)
@@ -2,7 +2,7 @@
  *
  *  D-Bus helper library
  *
- *  Copyright (C) 2004-2010  Marcel Holtmann <marcel@holtmann.org>
+ *  Copyright (C) 2004-2011  Marcel Holtmann <marcel@holtmann.org>
  *
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -477,6 +477,11 @@ static DBusHandlerResult service_filter(DBusConnection *connection,
                                cb->conn_func(connection, cb->user_data);
                }
 
+               /* Check if the watch was removed/freed by the callback
+                * function */
+               if (!g_slist_find(data->callbacks, cb))
+                       continue;
+
                /* Only auto remove if it is a bus name watch */
                if (data->argument[0] == ':' &&
                                (cb->conn_func == NULL || cb->disc_func == NULL)) {
@@ -484,11 +489,6 @@ static DBusHandlerResult service_filter(DBusConnection *connection,
                        continue;
                }
 
-               /* Check if the watch was removed/freed by the callback
-                * function */
-               if (!g_slist_find(data->callbacks, cb))
-                       continue;
-
                data->callbacks = g_slist_remove(data->callbacks, cb);
                data->processed = g_slist_append(data->processed, cb);
        }