[gedit] Prevent a crash with GeditStatusMenuButton



commit 284df9beccb729887031f1ce5b1fcf45e7efe0c5
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Dec 10 13:57:44 2015 +0100

    Prevent a crash with GeditStatusMenuButton
    
    The problem is not fixed at the source (in GeditWindow). But at least it
    will not crash anymore.
    
    GeditWindow dives deep in the containment hierarchy and connects to some
    GeditDocument signals. And it seems that a signal is not correctly
    disconnected and is called when GeditWindow is disposed. The code in
    GeditWindow is messy and there are other problems (getting the buffer
    with gtk_text_view_get_buffer() can return another buffer than the one
    that the signal was connected to, especially during destroys).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759174

 gedit/gedit-status-menu-button.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-status-menu-button.c b/gedit/gedit-status-menu-button.c
index ef4fefb..3f46a48 100644
--- a/gedit/gedit-status-menu-button.c
+++ b/gedit/gedit-status-menu-button.c
@@ -147,12 +147,16 @@ void
 gedit_status_menu_button_set_label (GeditStatusMenuButton *button,
                                     const gchar           *label)
 {
+       g_return_if_fail (GEDIT_IS_STATUS_MENU_BUTTON (button));
+
        gtk_label_set_markup (GTK_LABEL (button->label), label);
 }
 
 const gchar *
 gedit_status_menu_button_get_label (GeditStatusMenuButton *button)
 {
+       g_return_val_if_fail (GEDIT_IS_STATUS_MENU_BUTTON (button), NULL);
+
        return gtk_label_get_label (GTK_LABEL (button->label));
 }
 


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