From 5fcee54d498b776dd2b3ea940e1e4e24fcb6392c Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Tue, 26 Mar 2024 16:58:34 +0000 Subject: [PATCH] widgets: Prevent reordering actively edited layer effects Layer effects that have not yet been committed are not attached to the drawable. Trying to reorder them causes a crash since they're required to be attached for undo/redo purposes. This patch checks if they're committed beforehand, and informs the user with a warning if it's not possible. --- app/widgets/gimpitemtreeview.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/widgets/gimpitemtreeview.c b/app/widgets/gimpitemtreeview.c index 84bec9df36..c2ce666cce 100644 --- a/app/widgets/gimpitemtreeview.c +++ b/app/widgets/gimpitemtreeview.c @@ -2619,13 +2619,21 @@ static void gimp_item_tree_view_effects_raised_clicked (GtkWidget *widget, GimpItemTreeView *view) { + GimpImage *image = view->priv->image; + if (! view->priv->effects_filter || ! GIMP_IS_DRAWABLE_FILTER (view->priv->effects_filter)) return; + if (gimp_drawable_filter_get_mask (view->priv->effects_filter) == NULL) + { + gimp_message_literal (image->gimp, G_OBJECT (view), GIMP_MESSAGE_ERROR, + _("Cannot reorder a filter that is being edited.")); + return; + } + if (view->priv->effects_drawable) { - GimpImage *image = view->priv->image; GimpContainer *filters; gint index; @@ -2664,13 +2672,21 @@ static void gimp_item_tree_view_effects_lowered_clicked (GtkWidget *widget, GimpItemTreeView *view) { + GimpImage *image = view->priv->image; + if (! view->priv->effects_filter || ! GIMP_IS_DRAWABLE_FILTER (view->priv->effects_filter)) return; + if (gimp_drawable_filter_get_mask (view->priv->effects_filter) == NULL) + { + gimp_message_literal (image->gimp, G_OBJECT (view), GIMP_MESSAGE_ERROR, + _("Cannot reorder a filter that is being edited.")); + return; + } + if (view->priv->effects_drawable) { - GimpImage *image = view->priv->image; GimpContainer *filters; gint index;