Skip to contentSkip to conversation

gdbus: Don't try to remove removed sources

PATCH In review Bastien Nocera 3 participants 5 messages Nov 9, 2013 – Nov 11, 2013 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 gdbus: Don't try to remove removed sources

When we return FALSE from idle handlers, the source is removed. This will be causing warnings in glib 2.40.

See https://bugzilla.gnome.org/show_bug.cgi?id=710724

---
 gdbus/object.c | 3 +++
 1 file changed, 3 insertions(+)
gdbus/object.c +3 -0
index 268fed5..b248cbb 100644
@@ -1006,6 +1006,8 @@ static gboolean process_changes(gpointer user_data)
 	if (data->removed != NULL)
 		emit_interfaces_removed(data);
 
+	data->process_id = 0;
+
 	return FALSE;
 }
 
@@ -1019,6 +1021,7 @@ static void generic_unregister(DBusConnection *connection, void *user_data)
 
 	if (data->process_id > 0) {
 		g_source_remove(data->process_id);
+		data->process_id = 0;
 		process_changes(data);
 	}
 
Signature · 1 line
1.8.4.2
#1 lore raw
Quoted 4 lines · Bastien Nocera

When we return FALSE from idle handlers, the source is removed. This will be causing warnings in glib 2.40.

See https://bugzilla.gnome.org/show_bug.cgi?id=710724

Note that there's plenty of other places where this should be fixed. I'll leave those up to somebody who doesn't get RSI ;)

#2 lore raw
In reply to Bastien Nocera

Hi Bastien,

Quoted 8 lines · Bastien Nocera
Quoted 4 lines · Bastien Nocera

When we return FALSE from idle handlers, the source is removed. This will be causing warnings in glib 2.40.

See https://bugzilla.gnome.org/show_bug.cgi?id=710724

Note that there's plenty of other places where this should be fixed. I'll leave those up to somebody who doesn't get RSI ;)

Btw, did you really got a problem or was just by looking at the code? process_changes always call remove_pending so perhaps the problem was just in generic_unregister, so the change to process_changes was not really necessary.

Signature · 1 line
Luiz Augusto von Dentz
#3 lore raw
Quoted 9 lines · Luiz Augusto von Dentz

Hi Bastien,

Quoted 6 lines · Bastien Nocera
Quoted 4 lines · Bastien Nocera

When we return FALSE from idle handlers, the source is removed. This will be causing warnings in glib 2.40.

See https://bugzilla.gnome.org/show_bug.cgi?id=710724

Quoted 7 lines
Quoted 2 lines

Note that there's plenty of other places where this should be fixed. I'll leave those up to somebody who doesn't get RSI ;)

Btw, did you really got a problem or was just by looking at the code? process_changes always call remove_pending so perhaps the problem was just in generic_unregister, so the change to process_changes was not really necessary.

I really had the problem, and the patch fixed it. Resetting the id for idle callbacks and timeouts needs to happen at the end of each callback function, or you might be trying to remove an invalid source ID.