[gimp] plug-ins: gif export should not carry on when sanity_check() fails.



commit 765975dfd69cc53876a1242fe450ef267f46050d
Author: Jehan <jehan girinstud io>
Date:   Thu Sep 3 15:33:22 2015 +0200

    plug-ins: gif export should not carry on when sanity_check() fails.
    
    This specific crash was only occuring when GIMP_INTERACTIVE_EXPORT=1
    and canceling the first dialog. So that should not happen too often,
    but well, now it's fixed…

 plug-ins/common/file-gif-save.c |   62 +++++++++++++++++++-------------------
 1 files changed, 31 insertions(+), 31 deletions(-)
---
diff --git a/plug-ins/common/file-gif-save.c b/plug-ins/common/file-gif-save.c
index 64fe617..7c14a0e 100644
--- a/plug-ins/common/file-gif-save.c
+++ b/plug-ins/common/file-gif-save.c
@@ -287,39 +287,39 @@ run (const gchar      *name,
             }
         }
 
-      /* Create an exportable image based on the export options */
-      switch (run_mode)
-        {
-        case GIMP_RUN_INTERACTIVE:
-        case GIMP_RUN_WITH_LAST_VALS:
-          {
-            GimpExportCapabilities capabilities =
-              GIMP_EXPORT_CAN_HANDLE_INDEXED |
-              GIMP_EXPORT_CAN_HANDLE_GRAY |
-              GIMP_EXPORT_CAN_HANDLE_ALPHA;
-
-            if (gsvals.as_animation)
-              capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
-
-            export = gimp_export_image (&image_ID, &drawable_ID, "GIF",
-                                        capabilities);
-
-            if (export == GIMP_EXPORT_CANCEL)
-              {
-                values[0].data.d_status = GIMP_PDB_CANCEL;
-                if (sanitized_image_ID)
-                  gimp_image_delete (sanitized_image_ID);
-                return;
-              }
-          }
-          break;
-        default:
-          break;
-        }
-
-      /* Write the image to file */
       if (status == GIMP_PDB_SUCCESS)
         {
+          /* Create an exportable image based on the export options */
+          switch (run_mode)
+            {
+            case GIMP_RUN_INTERACTIVE:
+            case GIMP_RUN_WITH_LAST_VALS:
+                {
+                  GimpExportCapabilities capabilities =
+                    GIMP_EXPORT_CAN_HANDLE_INDEXED |
+                    GIMP_EXPORT_CAN_HANDLE_GRAY |
+                    GIMP_EXPORT_CAN_HANDLE_ALPHA;
+
+                  if (gsvals.as_animation)
+                    capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
+
+                  export = gimp_export_image (&image_ID, &drawable_ID, "GIF",
+                                              capabilities);
+
+                  if (export == GIMP_EXPORT_CANCEL)
+                    {
+                      values[0].data.d_status = GIMP_PDB_CANCEL;
+                      if (sanitized_image_ID)
+                        gimp_image_delete (sanitized_image_ID);
+                      return;
+                    }
+                }
+              break;
+            default:
+              break;
+            }
+
+          /* Write the image to file */
           if (save_image (param[3].data.d_string,
                           image_ID, drawable_ID, orig_image_ID,
                           &error))


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