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.
This commit is contained in:
Alx Sa 2024-03-26 16:58:34 +00:00
parent 5ce128a9fa
commit 5fcee54d49
1 changed files with 18 additions and 2 deletions

View File

@ -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;