Lua - recover from a locked drawing surface exception and log to the console, rather than crash the emulator
This commit is contained in:
parent
b1b94da6ef
commit
307845b3b5
|
@ -711,14 +711,21 @@ TESTEROO:
|
||||||
{
|
{
|
||||||
foreach (var kvp in LuaSurfaceSets)
|
foreach (var kvp in LuaSurfaceSets)
|
||||||
{
|
{
|
||||||
var surf = PeekLockedLuaSurface(kvp.Key);
|
try
|
||||||
DisplaySurface surfLocked = null;
|
{
|
||||||
if (surf == null)
|
var surf = PeekLockedLuaSurface(kvp.Key);
|
||||||
surf = surfLocked = LockLuaSurface(kvp.Key);
|
DisplaySurface surfLocked = null;
|
||||||
surf.Clear();
|
if (surf == null)
|
||||||
if(surfLocked != null)
|
surf = surfLocked = LockLuaSurface(kvp.Key);
|
||||||
UnlockLuaSurface(surfLocked);
|
surf.Clear();
|
||||||
LuaSurfaceSets[kvp.Key].SetPending(null);
|
if (surfLocked != null)
|
||||||
|
UnlockLuaSurface(surfLocked);
|
||||||
|
LuaSurfaceSets[kvp.Key].SetPending(null);
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
)]
|
)]
|
||||||
public void DrawNew(string name)
|
public void DrawNew(string name)
|
||||||
{
|
{
|
||||||
DrawFinish();
|
try
|
||||||
_luaSurface = GlobalWin.DisplayManager.LockLuaSurface(name);
|
{
|
||||||
|
DrawFinish();
|
||||||
|
_luaSurface = GlobalWin.DisplayManager.LockLuaSurface(name);
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException ex)
|
||||||
|
{
|
||||||
|
Log(ex.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawFinish()
|
public void DrawFinish()
|
||||||
|
|
Loading…
Reference in New Issue