From fbbdd73f7b53b41a56ad79e412583c6a39141dc4 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Sun, 14 Jun 2015 12:04:15 +0200 Subject: 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. taken from: https://git.gnome.org/browse/eog/commit/?id=c754959 --- cut-n-paste/toolbar-editor/egg-editable-toolbar.c | 9 +++++++-- 1 file changed, 7 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 006980e..b8ea050 100644 --- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c +++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c @@ -549,8 +549,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) { -- cgit v1.2.1