[geany/geany] ab4266: Fix racy glib assertion failure

Thomas Martitz git-noreply at xxxxx
Sun Jun 29 09:29:07 UTC 2014


Branch:      refs/heads/master
Author:      Thomas Martitz <kugel at rockbox.org>
Committer:   Thomas Martitz <kugel at rockbox.org>
Date:        Sun, 29 Jun 2014 09:29:07 UTC
Commit:      ab426623099dee3b8a187eefb662c7c022669b83
             https://github.com/geany/geany/commit/ab426623099dee3b8a187eefb662c7c022669b83

Log Message:
-----------
Fix racy glib assertion failure

Use g_signal_connect_object() to establish automatic and race-free signal
disconnection instead of the hand-crafted mechanism.


Modified Paths:
--------------
    src/document.c

Modified: src/document.c
11 lines changed, 3 insertions(+), 8 deletions(-)
===================================================================
@@ -3207,19 +3207,14 @@ static gboolean on_sci_key(GtkWidget *widget, GdkEventKey *event, gpointer data)
 	}
 }
 
-/* g_signal_handlers_disconnect_by_data is a macro that cannot be used as GCallback */
-static void on_bar_unrealize(GtkWidget *bar, ScintillaObject *sci)
-{
-	g_signal_handlers_disconnect_by_func(sci, on_sci_key, bar);
-}
 
+/* Sets up a signal handler to intercept some keys during the lifetime of the GtkInfoBar */
 static void enable_key_intercept(GeanyDocument *doc, GtkWidget *bar)
 {
-	g_signal_connect(doc->editor->sci, "key-press-event", G_CALLBACK(on_sci_key), bar);
-	/* make the signal disconnect automatically */
-	g_signal_connect(bar, "unrealize", G_CALLBACK(on_bar_unrealize), doc->editor->sci);
+	g_signal_connect_object(doc->editor->sci, "key-press-event", G_CALLBACK(on_sci_key), bar, 0);
 }
 
+
 static void monitor_reload_file(GeanyDocument *doc)
 {
 	gchar *base_name = g_path_get_basename(doc->file_name);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list