fix race condition in test of active window from input thread (which was a bad idea in the first place) which can throw null references in unlucky cases (fixes #917)

This commit is contained in:
zeromus 2017-07-15 22:09:50 -05:00
parent 4704f58ead
commit 60b9825f64
2 changed files with 4 additions and 3 deletions

View File

@ -414,6 +414,7 @@ namespace BizHawk.Client.EmuHawk
} }
//WHAT!? WE SHOULD NOT BE SO NAIVELY TOUCHING MAINFORM FROM THE INPUTTHREAD. ITS BUSY RUNNING.
bool swallow = !GlobalWin.MainForm.AllowInput(false); bool swallow = !GlobalWin.MainForm.AllowInput(false);
foreach (var ie in _NewEvents) foreach (var ie in _NewEvents)

View File

@ -643,15 +643,15 @@ namespace BizHawk.Client.EmuHawk
// even more special logic for TAStudio: // even more special logic for TAStudio:
// TODO - implement by event filter in TAStudio // TODO - implement by event filter in TAStudio
if (ActiveForm is TAStudio) var maybeTAStudio = ActiveForm as TAStudio;
if (maybeTAStudio != null)
{ {
if (yieldAlt) if (yieldAlt)
{ {
return false; return false;
} }
var ts = (TAStudio)ActiveForm; if (maybeTAStudio.IsInMenuLoop)
if (ts.IsInMenuLoop)
{ {
return false; return false;
} }