mirror of
				https://github.com/gnif/LookingGlass.git
				synced 2025-10-30 12:11:53 +00:00 
			
		
		
		
	[client] overlay: fix race on startup that caused a segfault
Fixes #1065
This commit is contained in:
		| @@ -656,8 +656,6 @@ MsgBoxHandle app_msgBox(const char * caption, const char * fmt, ...) | ||||
|   MsgBoxHandle handle = overlayMsg_show(caption, NULL, NULL, fmt, args); | ||||
|   va_end(args); | ||||
|  | ||||
|   core_updateOverlayState(); | ||||
|  | ||||
|   return handle; | ||||
| } | ||||
|  | ||||
| @@ -669,8 +667,6 @@ MsgBoxHandle app_confirmMsgBox(const char * caption, | ||||
|   MsgBoxHandle handle = overlayMsg_show(caption, callback, opaque, fmt, args); | ||||
|   va_end(args); | ||||
|  | ||||
|   core_updateOverlayState(); | ||||
|  | ||||
|   return handle; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -27,6 +27,7 @@ | ||||
| #include "common/stringlist.h" | ||||
|  | ||||
| #include "../main.h" | ||||
| #include "../core.h" | ||||
|  | ||||
| #include <string.h> | ||||
|  | ||||
| @@ -41,6 +42,8 @@ struct Msg | ||||
|  | ||||
| struct MsgState | ||||
| { | ||||
|   bool initialized; | ||||
|   bool updateOverlayState; | ||||
|   struct ll * messages; | ||||
| }; | ||||
|  | ||||
| @@ -53,6 +56,7 @@ static void msg_earlyInit(void) | ||||
|  | ||||
| static bool msg_init(void ** udata, const void * params) | ||||
| { | ||||
|   l_msg.initialized = true; | ||||
|   return true; | ||||
| } | ||||
|  | ||||
| @@ -70,6 +74,7 @@ static void msg_free(void * udata) | ||||
|   while(ll_shift(l_msg.messages, (void **)&msg)) | ||||
|     freeMsg(msg); | ||||
|   ll_free(l_msg.messages); | ||||
|   l_msg.initialized = false; | ||||
| } | ||||
|  | ||||
| static bool msg_needsOverlay(void * udata) | ||||
| @@ -181,6 +186,12 @@ struct LG_OverlayOps LGOverlayMsg = | ||||
|  | ||||
| bool overlayMsg_modal(void) | ||||
| { | ||||
|   if (l_msg.updateOverlayState) | ||||
|   { | ||||
|     core_updateOverlayState(); | ||||
|     l_msg.updateOverlayState = false; | ||||
|   } | ||||
|  | ||||
|   return ll_count(l_msg.messages) > 0; | ||||
| } | ||||
|  | ||||
| @@ -221,6 +232,11 @@ MsgBoxHandle overlayMsg_show( | ||||
|   ll_push(l_msg.messages, msg); | ||||
|   app_invalidateOverlay(false); | ||||
|  | ||||
|   if (l_msg.initialized) | ||||
|     core_updateOverlayState(); | ||||
|   else | ||||
|     l_msg.updateOverlayState = true; | ||||
|  | ||||
|   return (MsgBoxHandle)msg; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Geoffrey McRae
					Geoffrey McRae