diff options
author | Patrick Griffis <tingping@tingping.se> | 2016-07-24 21:14:11 -0400 |
---|---|---|
committer | Patrick Griffis <tingping@tingping.se> | 2016-07-24 21:14:11 -0400 |
commit | aabcf6f9f43c9b5346902cc013cae6d5bb7bc9ce (patch) | |
tree | 693558a4c3550cd26752a2f0048fa6fd89059381 /src/fe-gtk | |
parent | ac986bb3a47931b765b23560338e130d21c78abf (diff) |
Fix crashes when plugins modify UI during Close Context
This probably doesn't catch them all but setting tab color and printing text at least do not crash in the common case.
Diffstat (limited to 'src/fe-gtk')
-rw-r--r-- | src/fe-gtk/maingui.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c index 9c283166..9a406703 100644 --- a/src/fe-gtk/maingui.c +++ b/src/fe-gtk/maingui.c @@ -173,7 +173,7 @@ void fe_set_tab_color (struct session *sess, int col) { struct session *server_sess = sess->server->server_session; - if (sess->gui->is_tab && (col == 0 || sess != current_tab)) + if (sess->res->tab && sess->gui->is_tab && (col == 0 || sess != current_tab)) { switch (col) { @@ -1010,12 +1010,6 @@ static void mg_topdestroy_cb (GtkWidget *win, session *sess) { /* printf("enter mg_topdestroy. sess %p was destroyed\n", sess);*/ - - /* kill the text buffer */ - gtk_xtext_buffer_free (sess->res->buffer); - /* kill the user list */ - g_object_unref (G_OBJECT (sess->res->user_model)); - session_free (sess); /* tell hexchat.c about it */ } @@ -1026,11 +1020,6 @@ mg_ircdestroy (session *sess) { GSList *list; - /* kill the text buffer */ - gtk_xtext_buffer_free (sess->res->buffer); - /* kill the user list */ - g_object_unref (G_OBJECT (sess->res->user_model)); - session_free (sess); /* tell hexchat.c about it */ if (mg_gui == NULL) @@ -1092,7 +1081,10 @@ mg_tab_close (session *sess) int i; if (chan_remove (sess->res->tab, FALSE)) + { + sess->res->tab = NULL; mg_ircdestroy (sess); + } else { for (i = 0, list = sess_list; list; list = list->next) @@ -3653,6 +3645,9 @@ fe_server_callback (server *serv) void fe_session_callback (session *sess) { + gtk_xtext_buffer_free (sess->res->buffer); + g_object_unref (G_OBJECT (sess->res->user_model)); + if (sess->res->banlist && sess->res->banlist->window) mg_close_gen (NULL, sess->res->banlist->window); |