[gtranslator] toolbareditor: Fix a crash when dropping an item to the toolbar



commit 7fb95788016c53e19d13482116bf92af16a1dcdd
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sat Apr 21 11:01:04 2012 +0200

    toolbareditor: 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.

 src/toolbareditor/egg-editable-toolbar.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/toolbareditor/egg-editable-toolbar.c b/src/toolbareditor/egg-editable-toolbar.c
index a27b88a..89dc867 100644
--- a/src/toolbareditor/egg-editable-toolbar.c
+++ b/src/toolbareditor/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]