macOS: Give GnuCash time to shut down gracefully.

Instead of letting macOS pull the rug out.
This commit is contained in:
John Ralls 2020-09-05 17:00:56 -07:00
parent 706277e6a8
commit cbf2a7b9f1

View File

@ -3705,14 +3705,17 @@ gnc_quartz_shutdown (GtkosxApplication *theApp, gpointer data)
{ {
/* Do Nothing. It's too late. */ /* Do Nothing. It's too late. */
} }
/* Should quit responds to NSApplicationBlockTermination; returning /* Should quit responds to NSApplicationBlockTermination; returning TRUE means
* TRUE means "don't terminate", FALSE means "do terminate". * "don't terminate", FALSE means "do terminate". gnc_main_window_quit() queues
* a timer that starts an orderly shutdown in 250ms and if we tell macOS it's OK
* to quit GnuCash gets terminated instead of doing its orderly shutdown,
* leaving the book locked.
*/ */
static gboolean static gboolean
gnc_quartz_should_quit (GtkosxApplication *theApp, GncMainWindow *window) gnc_quartz_should_quit (GtkosxApplication *theApp, GncMainWindow *window)
{ {
if (gnc_main_window_all_finish_pending()) if (gnc_main_window_all_finish_pending())
return !gnc_main_window_quit (window); gnc_main_window_quit (window);
return TRUE; return TRUE;
} }