mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-12 13:00:32 +00:00
When executing python scripts temporarily catch exceptions in renderer
* Errors like syntax and runtime errors in python are thrown as exceptions. So for when we invoke onto the renderer thread to do some work, we need to be able to catch those exceptions otherwise the whole program dies. So over the execute, temporarily switch the thread into a catching-exception mode, which then gets rethrown on the invoker's thread. * Note that BeginInvoke shouldn't be used by python since the callback might happen after the execution has finished (there's no way to wait at the moment).
This commit is contained in:
@@ -128,7 +128,9 @@ namespace renderdocui.Windows.Dialogs
|
||||
|
||||
try
|
||||
{
|
||||
m_Core.Renderer.SetExceptionCatching(true);
|
||||
dynamic ret = engine.CreateScriptSourceFromString(script).Execute(scope);
|
||||
m_Core.Renderer.SetExceptionCatching(false);
|
||||
if (ret != null)
|
||||
{
|
||||
stdoutwriter.Write(ret.ToString() + Environment.NewLine);
|
||||
@@ -137,6 +139,8 @@ namespace renderdocui.Windows.Dialogs
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_Core.Renderer.SetExceptionCatching(false);
|
||||
|
||||
// IronPython throws so many exceptions, we don't want to kill the application
|
||||
// so we just swallow Exception to cover all the bases
|
||||
string exstr = engine.GetService<ExceptionOperations>().FormatException(ex);
|
||||
|
||||
Reference in New Issue
Block a user