call gtk_notebook_detach_tab only if the tab is detached

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1398234
master-1.22
Pablo Barciela 2017-01-30 23:34:19 +01:00
parent 371be35f99
commit 64dd47f16b
1 changed files with 14 additions and 3 deletions

View File

@ -44,6 +44,8 @@
#include "skey-popup.h" #include "skey-popup.h"
#endif #endif
static gboolean detach_tab = FALSE;
struct _TerminalWindowPrivate struct _TerminalWindowPrivate
{ {
GtkActionGroup *action_group; GtkActionGroup *action_group;
@ -2637,8 +2639,15 @@ terminal_window_remove_screen (TerminalWindow *window,
screen_container = terminal_screen_container_get_from_screen (screen); screen_container = terminal_screen_container_get_from_screen (screen);
#if GTK_CHECK_VERSION(3, 16, 0) #if GTK_CHECK_VERSION(3, 16, 0)
gtk_notebook_detach_tab (GTK_NOTEBOOK (priv->notebook), if (detach_tab)
GTK_WIDGET (screen_container)); {
gtk_notebook_detach_tab (GTK_NOTEBOOK (priv->notebook),
GTK_WIDGET (screen_container));
detach_tab = FALSE;
}
else
gtk_container_remove (GTK_CONTAINER (priv->notebook),
GTK_WIDGET (screen_container));
#else #else
gtk_container_remove (GTK_CONTAINER (priv->notebook), gtk_container_remove (GTK_CONTAINER (priv->notebook),
GTK_WIDGET (screen_container)); GTK_WIDGET (screen_container));
@ -2669,6 +2678,9 @@ terminal_window_move_screen (TerminalWindow *source_window,
*/ */
g_object_ref_sink (screen_container); g_object_ref_sink (screen_container);
g_object_ref_sink (screen); g_object_ref_sink (screen);
detach_tab = TRUE;
terminal_window_remove_screen (source_window, screen); terminal_window_remove_screen (source_window, screen);
/* Now we can safely remove the screen from the container and let the container die */ /* Now we can safely remove the screen from the container and let the container die */
@ -2922,7 +2934,6 @@ notebook_button_press_cb (GtkWidget *widget,
{ {
update_tab_visibility (window, -1); update_tab_visibility (window, -1);
gtk_notebook_remove_page(notebook, tab_clicked); gtk_notebook_remove_page(notebook, tab_clicked);
} }
later_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)); later_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));