Fix crash when closing a document with visible infobars

Apparently the ::unrealize symbol is sent too late, after we destroyed
the widget and freed the GeanyDocument, and some signals like
::focus-in-event can still be fired on the widget after that.

So, properly use the ::destroy signal that is supposed to be fired when
others should release references to that instance.
This commit is contained in:
Colomban Wendling 2014-08-07 15:14:22 +02:00
parent 8341228ffa
commit a26bdd628f

View File

@ -3215,7 +3215,7 @@ static gboolean on_sci_key(GtkWidget *widget, GdkEventKey *event, gpointer data)
static void enable_key_intercept(GeanyDocument *doc, GtkWidget *bar)
{
/* automatically focus editor again on bar close */
g_signal_connect_object(bar, "unrealize", G_CALLBACK(gtk_widget_grab_focus), doc->editor->sci,
g_signal_connect_object(bar, "destroy", G_CALLBACK(gtk_widget_grab_focus), doc->editor->sci,
G_CONNECT_SWAPPED);
g_signal_connect_object(doc->editor->sci, "key-press-event", G_CALLBACK(on_sci_key), bar, 0);
}