[gimp/gimp-2.10] plug-ins: fix crash when loading multi page TIFF images in non interactive mode



commit cf27d10dfa253fa3595b000a8550d7f05485c3fa
Author: Jacob Boerema <jgboerema gmail com>
Date:   Mon Aug 22 12:39:29 2022 -0400

    plug-ins: fix crash when loading multi page TIFF images in non interactive mode
    
    When loading a TIFF image using a script/plug-in in non interactive mode,
    we did not initialize the list of pages, causing a crash when trying to
    access it.
    
    So, always initialize this list when non interactive.
    
    (cherry picked from commit 853e9d5cb4c401f54e77ae2ef256006c59e0c442)

 plug-ins/file-tiff/file-tiff-load.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/plug-ins/file-tiff/file-tiff-load.c b/plug-ins/file-tiff/file-tiff-load.c
index f61bfe34be..7ea0f4a9d5 100644
--- a/plug-ins/file-tiff/file-tiff-load.c
+++ b/plug-ins/file-tiff/file-tiff-load.c
@@ -356,9 +356,11 @@ load_image (GFile        *file,
   for (li = 0; li < pages.n_pages; li++)
     pages.filtered_pages[li] = li;
 
-  if (pages.n_pages == 1)
+  if (pages.n_pages == 1 || run_mode != GIMP_RUN_INTERACTIVE)
     {
       pages.pages  = g_new0 (gint, pages.n_pages);
+      for (li = 0; li < pages.n_pages; li++)
+        pages.pages[li] = li;
       pages.target = GIMP_PAGE_SELECTOR_TARGET_LAYERS;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]