[gimp] app: exit GIMP more cleanly when quitting immediately after batch calls.



commit 46a335b68e3f9d50728f246ffa452e2d98aae806
Author: Jehan <jehan girinstud io>
Date:   Sat Apr 16 14:57:55 2022 +0200

    app: exit GIMP more cleanly when quitting immediately after batch calls.
    
    Call gimp_exit() rather than emitting the signal ourselves. This way in
    particular, the still-opened images are properly freed and we avoid
    GeglBuffer leaks from images we might have created in a batch script, or
    the images loaded in command lines.

 app/app.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/app/app.c b/app/app.c
index e9d18e6461..8e171fe786 100644
--- a/app/app.c
+++ b/app/app.c
@@ -428,20 +428,15 @@ app_run (const gchar         *full_prog_name,
     retval = gimp_batch_run (gimp, batch_interpreter, batch_commands);
 
   if (quit)
-    {
-      /* Return value, needed for the signal call; let's just ignore the
-       * result. */
-      gboolean cb_retval;
-
-      g_signal_emit_by_name (gimp, "exit", TRUE, &cb_retval);
-    }
+    /* Emit the "exit" signal, but also properly free all images still
+     * opened.
+     */
+    gimp_exit (gimp, TRUE);
   else
-    {
-      /* Only take into account the batch commands' success when we
-       * return immediately.
-       */
-      retval = EXIT_SUCCESS;
-    }
+    /* Only take into account the batch commands' success when we
+     * return immediately.
+     */
+    retval = EXIT_SUCCESS;
 
   if (run_loop)
     g_main_loop_run (loop);


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