[gimp] Issue #6280: JPEG preview window doesn't get closed.



commit aba721ae6867ab745a85558322432511b0af2d83
Author: Jehan <jehan girinstud io>
Date:   Fri Apr 30 01:31:18 2021 +0200

    Issue #6280: JPEG preview window doesn't get closed.
    
    The port had a slight error, because in gimp-2-10, the display_ID
    actually had 3 states: 0 when gimp_export_image() kept the original
    image to which we just add a preview layer, -1 when it created a new
    image which we wanted to put in its own display, and the display ID
    itself when created.
    
    With the new API where display variable is an object, we can only have 2
    cases. So I create an additional variable separate_display to make the
    distinction.

 plug-ins/file-jpeg/jpeg-save.c | 2 +-
 plug-ins/file-jpeg/jpeg.c      | 2 ++
 plug-ins/file-jpeg/jpeg.h      | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/plug-ins/file-jpeg/jpeg-save.c b/plug-ins/file-jpeg/jpeg-save.c
index a5b835052a..0ee08ff9bf 100644
--- a/plug-ins/file-jpeg/jpeg-save.c
+++ b/plug-ins/file-jpeg/jpeg-save.c
@@ -743,7 +743,7 @@ make_preview (GimpProcedureConfig *config)
 
       g_object_unref (file);
 
-      if (! display)
+      if (separate_display)
         display = gimp_display_new (preview_image);
     }
   else
diff --git a/plug-ins/file-jpeg/jpeg.c b/plug-ins/file-jpeg/jpeg.c
index 478c497738..fcd1474cc7 100644
--- a/plug-ins/file-jpeg/jpeg.c
+++ b/plug-ins/file-jpeg/jpeg.c
@@ -85,6 +85,7 @@ GIMP_MAIN (JPEG_TYPE)
 
 gboolean         undo_touched      = FALSE;
 GimpDisplay     *display           = NULL;
+gboolean         separate_display  = FALSE;
 GimpImage       *orig_image_global = NULL;
 GimpDrawable    *drawable_global   = NULL;
 
@@ -470,6 +471,7 @@ jpeg_save (GimpProcedure        *procedure,
               }
 
             display = NULL;
+            separate_display = TRUE;
           }
           break;
 
diff --git a/plug-ins/file-jpeg/jpeg.h b/plug-ins/file-jpeg/jpeg.h
index 4b8a81d622..84171d846a 100644
--- a/plug-ins/file-jpeg/jpeg.h
+++ b/plug-ins/file-jpeg/jpeg.h
@@ -56,6 +56,7 @@ extern GimpLayer *      preview_layer;
 extern gboolean         undo_touched;
 extern gboolean         load_interactive;
 extern GimpDisplay     *display;
+extern gboolean         separate_display;
 
 
 void      destroy_preview               (void);


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