[eog] toolbar-editor: Fix a crash when dropping an item to the toolbar



commit c7549594ed526151c3b22668c0cee74f5937ba7a
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Mon Feb 6 17:08:37 2012 +0000

    toolbar-editor: Fix a crash when dropping an item to the toolbar
    
    action_sensitive_cb can be called with the dnd tool item when it doesn't
    have an ancestor.
    
    (Cherry-picked from Evince to eog to fix bug #671202)
    https://bugzilla.gnome.org/show_bug.cgi?id=671202

 cut-n-paste/toolbar-editor/egg-editable-toolbar.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c
index 6bac1f7..93738ce 100644
--- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c
+++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c
@@ -605,9 +605,13 @@ action_sensitive_cb (GtkAction   *action,
                      GParamSpec  *pspec,
                      GtkToolItem *item)
 {
-  EggEditableToolbar *etoolbar = EGG_EDITABLE_TOOLBAR
-    (gtk_widget_get_ancestor (GTK_WIDGET (item), EGG_TYPE_EDITABLE_TOOLBAR));
+  EggEditableToolbar *etoolbar;
+  GtkWidget *ancestor = gtk_widget_get_ancestor (GTK_WIDGET (item), EGG_TYPE_EDITABLE_TOOLBAR);
 
+  if (!ancestor)
+    return;
+
+  etoolbar = EGG_EDITABLE_TOOLBAR (ancestor);
   if (etoolbar->priv->edit_mode > 0)
     {
       gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE);



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