- changed the place where the CheckRequireMouse event gets called.
The original place in I_CheckNativeMouse is unsafe because that function can get called from the system message queue which can result in a bad global state of the VM for such a call because it can be recursively invoked from code that may temporarily alter some settings.
This commit is contained in:
parent
484485f3cf
commit
d005e0b483
3 changed files with 10 additions and 6 deletions
|
|
@ -150,6 +150,9 @@ extern bool AppActive;
|
|||
int SessionState = 0;
|
||||
int BlockMouseMove;
|
||||
|
||||
static bool EventHandlerResultForNativeMouse;
|
||||
|
||||
|
||||
CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
CVAR (Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
||||
|
|
@ -457,11 +460,11 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
return 0;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
I_CheckNativeMouse (true); // Make sure mouse gets released right away
|
||||
I_CheckNativeMouse (true, false); // Make sure mouse gets released right away
|
||||
break;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
I_CheckNativeMouse (false);
|
||||
I_CheckNativeMouse (false, EventHandlerResultForNativeMouse); // This cannot call the event handler. Doing it from here is unsafe.
|
||||
break;
|
||||
|
||||
case WM_SETCURSOR:
|
||||
|
|
@ -778,7 +781,8 @@ void I_StartTic ()
|
|||
BlockMouseMove--;
|
||||
ResetButtonTriggers ();
|
||||
I_CheckGUICapture ();
|
||||
I_CheckNativeMouse (false);
|
||||
EventHandlerResultForNativeMouse = eventManager.CheckRequireMouse();
|
||||
I_CheckNativeMouse (false, EventHandlerResultForNativeMouse);
|
||||
I_GetEvent ();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue