From 43c57af5d7dd4e5dfd0addfde22e526e8dbe2353 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Sat, 28 Mar 2026 05:09:31 +0000 Subject: [PATCH] libgimp: Resolves #16102 The active selection can impact the other NDE filters when exporting, resulting in empty spaces displayed when the filter is outside the area of that selection. Similar to what we do with XCF saving, we temporarily save and clear the selection in the duplicated image. Then we merge the filters and restore the active selection. --- libgimp/gimpexportoptions.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/libgimp/gimpexportoptions.c b/libgimp/gimpexportoptions.c index 78f3e3b413..06c765e14e 100644 --- a/libgimp/gimpexportoptions.c +++ b/libgimp/gimpexportoptions.c @@ -860,14 +860,20 @@ gimp_export_options_get_image (GimpExportOptions *options, if (retval == GIMP_EXPORT_EXPORT) { - GSList *list; - GList *drawables_in; - GList *drawables_out; + GSList *list; + GList *drawables_in; + GList *drawables_out; + GimpChannel *selection_copy; *image = gimp_image_duplicate (*image); drawables_in = gimp_image_list_selected_layers (*image); drawables_out = drawables_in; + /* Temporarily remove selection so that any merged filters + * aren't affected by it */ + selection_copy = GIMP_CHANNEL (gimp_selection_save (*image)); + gimp_selection_none (*image); + gimp_image_undo_disable (*image); for (list = actions; list; list = list->next) @@ -882,6 +888,10 @@ gimp_export_options_get_image (GimpExportOptions *options, } g_list_free (drawables_out); + + gimp_image_select_item (*image, GIMP_CHANNEL_OP_REPLACE, + GIMP_ITEM (selection_copy)); + gimp_image_remove_channel (*image, selection_copy); } g_slist_free (actions);