From 46a335b68e3f9d50728f246ffa452e2d98aae806 Mon Sep 17 00:00:00 2001 From: Jehan Date: Sat, 16 Apr 2022 14:57:55 +0200 Subject: [PATCH] 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);