LuaConsole - protect WriteToOutputWindow() and ClearOutputWindow() in case lua console is closed when called. Close the lua object on LuaConsole close (fixes some crashes).
This commit is contained in:
parent
41708a8579
commit
0082876510
|
@ -28,6 +28,12 @@ namespace BizHawk.MultiClient
|
||||||
Caller = passed.get();
|
Caller = passed.get();
|
||||||
LuaRegister(lua);
|
LuaRegister(lua);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
lua.Close();
|
||||||
|
}
|
||||||
|
|
||||||
public void LuaRegister(Lua lua)
|
public void LuaRegister(Lua lua)
|
||||||
{
|
{
|
||||||
lua.RegisterFunction("print", this, this.GetType().GetMethod("print"));
|
lua.RegisterFunction("print", this, this.GetType().GetMethod("print"));
|
||||||
|
|
|
@ -104,6 +104,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
private void SaveConfigSettings()
|
private void SaveConfigSettings()
|
||||||
{
|
{
|
||||||
|
LuaImp.Close();
|
||||||
Global.Config.LuaConsoleWndx = this.Location.X;
|
Global.Config.LuaConsoleWndx = this.Location.X;
|
||||||
Global.Config.LuaConsoleWndy = this.Location.Y;
|
Global.Config.LuaConsoleWndy = this.Location.Y;
|
||||||
Global.Config.LuaConsoleWidth = this.Right - this.Left;
|
Global.Config.LuaConsoleWidth = this.Right - this.Left;
|
||||||
|
@ -559,12 +560,18 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public void WriteToOutputWindow(string message)
|
public void WriteToOutputWindow(string message)
|
||||||
{
|
{
|
||||||
|
if (!OutputBox.IsHandleCreated || OutputBox.IsDisposed)
|
||||||
|
return;
|
||||||
|
|
||||||
OutputBox.Text += message;
|
OutputBox.Text += message;
|
||||||
OutputBox.Refresh();
|
OutputBox.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearOutputWindow()
|
public void ClearOutputWindow()
|
||||||
{
|
{
|
||||||
|
if (!OutputBox.IsHandleCreated || OutputBox.IsDisposed)
|
||||||
|
return;
|
||||||
|
|
||||||
OutputBox.Text = "";
|
OutputBox.Text = "";
|
||||||
OutputBox.Refresh();
|
OutputBox.Refresh();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue