[gimp] app: wait for pending events before actually quitting.



commit 2d3476805e72fc2ca360d8f2cbd80e8d868e4cf1
Author: Jehan <jehan girinstud io>
Date:   Sat Apr 16 00:40:39 2022 +0200

    app: wait for pending events before actually quitting.
    
    This should fix various hard-to-reproduce cases of:
    
    > (gimp-2.99:50596): Gimp-Core-WARNING **: 00:42:45.324: gimp_finalize: list of contexts not empty upon 
exit (2 contexts left)
    >
    > stale context: (null)
    > stale context: PDB Context
    
    We had these warnings happening randomly at exit and not always
    reproduceable with the same steps. I had it reproduced much more easily
    when working with CLI scripts exiting GIMP immediately. The context were
    actually properly unref-ed but simply we had to wait a bit for events to
    be processed before destroying the main GIMP object.

 app/app.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/app/app.c b/app/app.c
index 4a50d20269..4a376e2f5d 100644
--- a/app/app.c
+++ b/app/app.c
@@ -437,6 +437,9 @@ app_run (const gchar         *full_prog_name,
 
   errors_exit ();
 
+  while (g_main_context_pending (NULL))
+    g_main_context_iteration (NULL, TRUE);
+
   g_object_unref (gimp);
 
   gimp_debug_instances ();


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