Lua - recover from a locked drawing surface exception and log to the console, rather than crash the emulator

This commit is contained in:
adelikat 2015-01-29 02:14:39 +00:00
parent b1b94da6ef
commit 307845b3b5
2 changed files with 24 additions and 10 deletions

View File

@ -711,14 +711,21 @@ TESTEROO:
{
foreach (var kvp in LuaSurfaceSets)
{
var surf = PeekLockedLuaSurface(kvp.Key);
DisplaySurface surfLocked = null;
if (surf == null)
surf = surfLocked = LockLuaSurface(kvp.Key);
surf.Clear();
if(surfLocked != null)
UnlockLuaSurface(surfLocked);
LuaSurfaceSets[kvp.Key].SetPending(null);
try
{
var surf = PeekLockedLuaSurface(kvp.Key);
DisplaySurface surfLocked = null;
if (surf == null)
surf = surfLocked = LockLuaSurface(kvp.Key);
surf.Clear();
if (surfLocked != null)
UnlockLuaSurface(surfLocked);
LuaSurfaceSets[kvp.Key].SetPending(null);
}
catch (InvalidOperationException)
{
}
}
}

View File

@ -52,8 +52,15 @@ namespace BizHawk.Client.EmuHawk
)]
public void DrawNew(string name)
{
DrawFinish();
_luaSurface = GlobalWin.DisplayManager.LockLuaSurface(name);
try
{
DrawFinish();
_luaSurface = GlobalWin.DisplayManager.LockLuaSurface(name);
}
catch (InvalidOperationException ex)
{
Log(ex.ToString());
}
}
public void DrawFinish()