Diff between 07858bca3c40f14fba00a74c1747485e04d0e953 and ca0b4c4c658ba61b5a23ed9dde2bebc4558fe032

Changed Files

File Additions Deletions Status
gdbus/watch.c +8 -9 modified

Full Patch

diff --git a/gdbus/watch.c b/gdbus/watch.c
index 9a716b0..d749176 100644
--- a/gdbus/watch.c
+++ b/gdbus/watch.c
@@ -376,15 +376,14 @@ static gboolean filter_data_remove_callback(struct filter_data *data,
 
 	connection = dbus_connection_ref(data->connection);
 	listeners = g_slist_remove(listeners, data);
-	filter_data_free(data);
 
 	/* Remove filter if there are no listeners left for the connection */
-	data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
-					NULL);
-	if (data == NULL)
+	if (filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
+								NULL) == NULL)
 		dbus_connection_remove_filter(connection, message_filter,
 						NULL);
 
+	filter_data_free(data);
 	dbus_connection_unref(connection);
 
 	return TRUE;
@@ -537,15 +536,15 @@ static DBusHandlerResult message_filter(DBusConnection *connection,
 	remove_match(data);
 
 	listeners = g_slist_remove(listeners, data);
-	filter_data_free(data);
 
-	/* Remove filter if there no listener left for the connection */
-	data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
-					NULL);
-	if (data == NULL)
+	/* Remove filter if there are no listeners left for the connection */
+	if (filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
+								NULL) == NULL)
 		dbus_connection_remove_filter(connection, message_filter,
 						NULL);
 
+	filter_data_free(data);
+
 	return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }