[gedit/wip/tabs] The dispose may have run when setting null to the menubutton



commit f1e5751fed79fcab9c0f4992dd89880cde8c8a15
Author: Ignacio Casal Quinteiro <ignacio casal nice-software com>
Date:   Fri Jul 12 20:05:10 2013 +0200

    The dispose may have run when setting null to the menubutton

 gedit/gedit-notebook.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gedit/gedit-notebook.c b/gedit/gedit-notebook.c
index a1a06c9..a3fc8e9 100644
--- a/gedit/gedit-notebook.c
+++ b/gedit/gedit-notebook.c
@@ -404,6 +404,7 @@ gedit_notebook_page_removed (GtkNotebook *notebook,
                              guint        page_num)
 {
        GeditNotebook *nb = GEDIT_NOTEBOOK (notebook);
+       GeditNotebookPrivate *priv = nb->priv;
        gint num_pages;
        gint curr;
        GtkWidget *tab_label;
@@ -421,8 +422,8 @@ gedit_notebook_page_removed (GtkNotebook *notebook,
        }
 
        /* Remove the page from the focused pages list */
-       nb->priv->focused_pages =  g_list_remove (nb->priv->focused_pages,
-                                                 page);
+       priv->focused_pages =  g_list_remove (priv->focused_pages,
+                                             page);
 
        curr = gtk_notebook_get_current_page (notebook);
 
@@ -438,10 +439,10 @@ gedit_notebook_page_removed (GtkNotebook *notebook,
                /* If there is no tabs, calling this is pointless */
                update_tabs_visibility (nb, FALSE);
        }
-       else
+       else if (priv->documents_button)
        {
                /* Unset the menu model from the button to make it insensitive */
-               gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (nb->priv->documents_button),
+               gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (priv->documents_button),
                                                NULL);
        }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]