diff options
3 files changed, 28 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index f695eba..16641f7 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -93,6 +93,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
93 | bool ShuttingDown { get; set; } | 93 | bool ShuttingDown { get; set; } |
94 | 94 | ||
95 | /// <summary> | 95 | /// <summary> |
96 | /// When stopping the script: should it remain stopped permanently (i.e., save !Running in its state)? | ||
97 | /// </summary> | ||
98 | bool StayStopped { get; set; } | ||
99 | |||
100 | /// <summary> | ||
96 | /// Script state | 101 | /// Script state |
97 | /// </summary> | 102 | /// </summary> |
98 | string State { get; set; } | 103 | string State { get; set; } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index c6512ba..6541256 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -126,7 +126,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | public bool Running { get; set; } | 129 | public bool Running |
130 | { | ||
131 | get { return m_running; } | ||
132 | |||
133 | set | ||
134 | { | ||
135 | m_running = value; | ||
136 | if (m_running) | ||
137 | StayStopped = false; | ||
138 | } | ||
139 | } | ||
140 | private bool m_running; | ||
130 | 141 | ||
131 | public bool Suspended | 142 | public bool Suspended |
132 | { | 143 | { |
@@ -158,6 +169,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
158 | 169 | ||
159 | public string State { get; set; } | 170 | public string State { get; set; } |
160 | 171 | ||
172 | public bool StayStopped { get; set; } | ||
173 | |||
161 | public IScriptEngine Engine { get; private set; } | 174 | public IScriptEngine Engine { get; private set; } |
162 | 175 | ||
163 | public UUID AppDomain { get; set; } | 176 | public UUID AppDomain { get; set; } |
@@ -1077,7 +1090,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
1077 | 1090 | ||
1078 | public void SaveState() | 1091 | public void SaveState() |
1079 | { | 1092 | { |
1080 | if (!Running) | 1093 | if (!Running && !StayStopped) |
1081 | return; | 1094 | return; |
1082 | 1095 | ||
1083 | // We cannot call this inside the EventQueue lock since it will currently take AsyncCommandManager.staticLock. | 1096 | // We cannot call this inside the EventQueue lock since it will currently take AsyncCommandManager.staticLock. |
@@ -1089,7 +1102,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
1089 | lock (EventQueue) | 1102 | lock (EventQueue) |
1090 | { | 1103 | { |
1091 | // Check again to avoid a race with a thread in Stop() | 1104 | // Check again to avoid a race with a thread in Stop() |
1092 | if (!Running) | 1105 | if (!Running && !StayStopped) |
1093 | return; | 1106 | return; |
1094 | 1107 | ||
1095 | // If we're currently in an event, just tell it to save upon return | 1108 | // If we're currently in an event, just tell it to save upon return |
@@ -1130,6 +1143,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
1130 | //} | 1143 | //} |
1131 | m_CurrentStateHash = hash; | 1144 | m_CurrentStateHash = hash; |
1132 | } | 1145 | } |
1146 | |||
1147 | StayStopped = false; | ||
1133 | } | 1148 | } |
1134 | } | 1149 | } |
1135 | 1150 | ||
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 5071884..62bf803 100755 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -699,6 +699,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
699 | { | 699 | { |
700 | if (instance.Running) | 700 | if (instance.Running) |
701 | { | 701 | { |
702 | instance.StayStopped = true; // the script was stopped explicitly | ||
703 | |||
702 | instance.Stop(0); | 704 | instance.Stop(0); |
703 | 705 | ||
704 | SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID); | 706 | SceneObjectPart sop = m_Scene.GetSceneObjectPart(instance.ObjectID); |
@@ -1914,6 +1916,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1914 | 1916 | ||
1915 | if (instance != null) | 1917 | if (instance != null) |
1916 | { | 1918 | { |
1919 | lock (instance.EventQueue) | ||
1920 | instance.StayStopped = true; // the script was stopped explicitly | ||
1921 | |||
1917 | instance.Stop(m_WaitForEventCompletionOnScriptStop); | 1922 | instance.Stop(m_WaitForEventCompletionOnScriptStop); |
1918 | } | 1923 | } |
1919 | else | 1924 | else |