diff options
Diffstat (limited to 'lib/egg/egg-editable-toolbar.c')
-rwxr-xr-x | lib/egg/egg-editable-toolbar.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c index 746affc42..7d1fe1f8a 100755 --- a/lib/egg/egg-editable-toolbar.c +++ b/lib/egg/egg-editable-toolbar.c @@ -419,8 +419,7 @@ drag_data_received_cb (GtkWidget *widget, target = gtk_drag_dest_find_target (widget, context, NULL); type = egg_toolbars_model_get_item_type (etoolbar->priv->model, target); - id = egg_toolbars_model_get_item_id (etoolbar->priv->model, type, - selection_data->data); + id = egg_toolbars_model_get_item_id (etoolbar->priv->model, type, selection_data->data); /* This function can be called for two reasons * @@ -433,6 +432,13 @@ drag_data_received_cb (GtkWidget *widget, * actually add a new item to the toolbar. */ + if (id == NULL) + { + etoolbar->priv->pending = FALSE; + g_free (type); + return; + } + if (etoolbar->priv->pending) { etoolbar->priv->pending = FALSE; @@ -453,11 +459,6 @@ drag_data_received_cb (GtkWidget *widget, } else { - type = egg_toolbars_model_get_item_type (etoolbar->priv->model, - target); - id = egg_toolbars_model_get_item_id (etoolbar->priv->model, type, - selection_data->data); - egg_toolbars_model_add_item (etoolbar->priv->model, toolbar_pos, pos, id, type); } @@ -591,9 +592,12 @@ toolbar_drag_motion_cb (GtkWidget *widget, /* The handler will make sure the item is created */ gtk_drag_get_data (widget, context, target, time); - g_assert (etoolbar->priv->dragged_item); g_assert (!etoolbar->priv->pending); + if (etoolbar->priv->dragged_item == NULL) { + return TRUE; + } + g_object_ref (etoolbar->priv->dragged_item); gtk_object_sink (GTK_OBJECT (etoolbar->priv->dragged_item)); } |