diff --git a/src/document.c b/src/document.c index 3ab82d57..2a937bd9 100644 --- a/src/document.c +++ b/src/document.c @@ -3180,17 +3180,16 @@ 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 gint nonmacro_g_signal_handlers_disconnect_by_data(gpointer instance, gpointer data) +static void on_bar_unrealize(GtkWidget *bar, ScintillaObject *sci) { - return g_signal_handlers_disconnect_by_data(instance, data); + g_signal_handlers_disconnect_by_func(sci, on_sci_key, bar); } static void enable_key_intercept(GeanyDocument *doc, GtkWidget *bar) { - g_signal_connect(doc->editor->sci, "key-press-event", G_CALLBACK(on_sci_key), bar); + g_signal_connect(doc->editor->sci, "key-press-event", G_CALLBACK(on_sci_key), bar); /* make the signal disconnect automatically */ - g_signal_connect_swapped(bar, "unrealize", - G_CALLBACK(nonmacro_g_signal_handlers_disconnect_by_data), doc->editor->sci); + g_signal_connect(bar, "unrealize", G_CALLBACK(on_bar_unrealize), doc->editor->sci); } static void monitor_reload_file(GeanyDocument *doc)