From 1858d72d032a0bd4ccb26b62f3e8c8310b9f61f6 Mon Sep 17 00:00:00 2001 From: Jacob Boerema Date: Thu, 6 Jan 2022 15:03:51 -0500 Subject: [PATCH] app: fix #7682 crash loading xcf with linked text layers Due to recent changes on master the linked layers concept doesn't exist anymore. The conversion code checks whether all linked layers are valid. However, text layers need special handling. In the past updating the linked_layers wasn't needed when the layer pointer of a text layer was changed. Now, that has changed because we parse that list for valid layers. To fix this we update linked_layers in the same way as already was done for selected_layers. --- app/xcf/xcf-load.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c index 53d625d594..2a30ba9222 100644 --- a/app/xcf/xcf-load.c +++ b/app/xcf/xcf-load.c @@ -2082,6 +2082,7 @@ xcf_load_layer (XcfInfo *info, gboolean edit_mask = FALSE; gboolean show_mask = FALSE; GList *selected; + GList *linked; gboolean floating; guint32 group_layer_flags = 0; guint32 text_layer_flags = 0; @@ -2205,6 +2206,7 @@ xcf_load_layer (XcfInfo *info, /* call the evil text layer hack that might change our layer pointer */ selected = g_list_find (info->selected_layers, layer); + linked = g_list_find (info->linked_layers, layer); floating = (info->floating_sel == layer); if (gimp_text_layer_xcf_load_hack (&layer)) @@ -2217,6 +2219,11 @@ xcf_load_layer (XcfInfo *info, info->selected_layers = g_list_delete_link (info->selected_layers, selected); info->selected_layers = g_list_prepend (info->selected_layers, layer); } + if (linked) + { + info->linked_layers = g_list_delete_link (info->linked_layers, linked); + info->linked_layers = g_list_prepend (info->linked_layers, layer); + } if (floating) info->floating_sel = layer; }