From 47fb015afbe44e97bf7b12628636e0c101ce5d15 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 10 Apr 2015 14:24:23 -0400 Subject: [PATCH] More TODO resolution and cross-OS behavioral parity fixes. --- new/main_darwin.m | 3 +-- new/main_unix.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/new/main_darwin.m b/new/main_darwin.m index 981567c..58b2373 100644 --- a/new/main_darwin.m +++ b/new/main_darwin.m @@ -21,6 +21,5 @@ void uiQuit(void) subtype:0 data1:0 data2:0]; - [NSApp postEvent:e atStart:NO]; // let pending events take priority - // TODO really wait? + [NSApp postEvent:e atStart:NO]; // let pending events take priority (this is what PostQuitMessage() on Windows does so we have to do it here too for parity; thanks to mikeash in irc.freenode.net/#macdev for confirming that this parameter should indeed be NO) } diff --git a/new/main_unix.c b/new/main_unix.c index 90374c7..10af782 100644 --- a/new/main_unix.c +++ b/new/main_unix.c @@ -8,7 +8,16 @@ void uiMain(void) gtk_main(); } -void uiQuit(void) +// gtk_main_quit() may run immediately, or it may wait for other pending events; "it depends" (thanks mclasen in irc.gimp.net/#gtk+) +// PostQuitMessage() on Windows always waits, so we must do so too +// we'll do it by using an idle callback +static gboolean quit(gpointer data) { gtk_main_quit(); + return FALSE; +} + +void uiQuit(void) +{ + gdk_threads_add_idle(quit, NULL); }