changeset 62:8ad0f4c587b0

Protect the exit code with the mutex so there are no threads calling APIs. This prevents a deadlock on MacOS Mojave where API calls requiring running on the main thread might be stuck in a mutex when the message loop ends.
author Brian Smith <brian@dbsoft.org>
date Fri, 06 Sep 2019 02:59:34 -0500
parents c9fe1c154171
children f4c276a77745
files cc.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/cc.c	Tue Aug 06 17:14:21 2019 -0500
+++ b/cc.c	Fri Sep 06 02:59:34 2019 -0500
@@ -534,10 +534,12 @@
 /* Context menus */
 int DWSIGNAL display_exit(HWND hwnd, void *data)
 {
+	dw_mutex_lock(hMtx);
 	display_active = FALSE;
 	update_pos();
 	saveconfig();
 	dw_main_quit();
+	dw_mutex_unlock(hMtx);
 	return TRUE;
 }