Fixed bug that occurs sometimes on script unload where queued script event was attempted executed after AppDomain was unloaded.

afrisby
Tedd Hansen 2007-08-26 08:20:48 +00:00
parent 0cd6d26adb
commit 25e200c46a
2 changed files with 63 additions and 47 deletions

View File

@ -130,6 +130,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{ {
QueueItemStruct BlankQIS = new QueueItemStruct(); QueueItemStruct BlankQIS = new QueueItemStruct();
while (true) while (true)
{
try
{ {
QueueItemStruct QIS = BlankQIS; QueueItemStruct QIS = BlankQIS;
bool GotItem = false; bool GotItem = false;
@ -182,6 +184,11 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
} }
} // Something in queue } // Something in queue
} catch {ThreadAbortException tae) {
throw tae;
} catch (Exception e) {
Console.WriteLine("Exception in EventQueueThreadLoop: " + e.ToString());
}
} // while } // while
} // try } // try
catch (ThreadAbortException tae) catch (ThreadAbortException tae)

View File

@ -362,9 +362,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// Execute a function in the script // Execute a function in the script
//m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName); //m_scriptEngine.Log.Verbose("ScriptEngine", "Executing Function localID: " + localID + ", itemID: " + itemID + ", FunctionName: " + FunctionName);
LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(localID, itemID); LSL_BaseClass Script = m_scriptEngine.myScriptManager.GetScript(localID, itemID);
if (Script == null)
return;
// Must be done in correct AppDomain, so leaving it up to the script itself // Must be done in correct AppDomain, so leaving it up to the script itself
try
{
Script.Exec.ExecuteEvent(FunctionName, args); Script.Exec.ExecuteEvent(FunctionName, args);
}
catch (Exception e)
{
Console.WriteLine("Exception executing script funcion: " + e.ToString());
}
} }