app: quick/dirty-exit on all releases (not just stable ones) while…

… clean-exiting on all dev code (whether stable or unstable branches).

This is because the dirty exit prevents the on-exit crashes which seem to happen
somewhere in the memory cleanup (which apparently corrupts memory but all crash
traces don't show the proper area where the issue actually hapened). So let's
have release exit the process without issue (at least all important user-facing
data is saved properly by then), while not hiding the issue to developers.

Also on dev code, the GIMP_DIRTY_EXIT will allow to go anyway for the quick
exit() path, so that for instance one can work on other pieces of code without
feeling bothered by the constant crashes on exit.

For the record, the crashes we are talking about appear when you update to a
recent GLib, after the removal of GSlice implementation (which is basically now
just a malloc/free alias). There may be issues in our usage of GSlice though we
also experience crashes even just with commit 69e9ba80e on GLib which hints at
issues in our GObject/GType code.
This commit is contained in:
Jehan 2023-05-12 13:47:36 +02:00
parent 39bcdc9e40
commit d22f1c3332
1 changed files with 24 additions and 6 deletions

View File

@ -551,18 +551,36 @@ app_exit_after_callback (Gimp *gimp,
* to catch possible problems in our finalizers.
*/
#ifdef GIMP_UNSTABLE
g_application_quit (G_APPLICATION (app));
#else
#ifdef GIMP_RELEASE
gimp_gegl_exit (gimp);
gegl_exit ();
exit (gimp_core_app_get_exit_status (GIMP_CORE_APP (app)));
#else
if (g_getenv ("GIMP_DIRTY_EXIT"))
{
gimp_gegl_exit (gimp);
gegl_exit ();
exit (gimp_core_app_get_exit_status (GIMP_CORE_APP (app)));
}
else
{
/* Since GLib recent changes removing glice implementation and also in
* GType code, we experience crashes during exit. There is a clear memory
* corruption going on, but it's extremely hard to diagnose.
* We don't want to hide these on development builds, so by default, we
* will exit cleanly (with crashes), leaving contributors a chance to look
* at it.
* With the GIMP_DIRTY_EXIT environment variable, people will be able to
* more quickly exit the process, bypassing memory cleanup issues, without
* having to rebuild. This way, it's also good to work on other code and
* not be bothered by the crashes-on-exit until we find the reasons.
*/
g_application_quit (G_APPLICATION (app));
}
#endif
return FALSE;