File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,13 @@ struct EngineOwnData {
8585 return index;
8686 }
8787 inline bool removeUnloadCallback (int pIndex) { return unloadCallbacks.erase (pIndex); }
88+
89+ static void clearEngineObjects (ScriptEngine* engine) {
90+ EngineScope scope (engine);
91+ auto data = std::static_pointer_cast<EngineOwnData>(engine->getData ());
92+ data->playerDataDB .clear ();
93+ // LLSERemoveAllExportedFuncs(engine);
94+ }
8895};
8996
9097// Engine additional data
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ ll::Expected<> PluginManager::load(ll::mod::Manifest manifest) {
235235 LLSERemoveCmdCallback (scriptEngine);
236236 LLSERemoveAllExportedFuncs (scriptEngine);
237237
238- scriptEngine-> getData (). reset ( );
238+ EngineOwnData::clearEngineObjects (scriptEngine );
239239 EngineManager::unregisterEngine (scriptEngine);
240240#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS
241241 NodeJsHelper::stopEngine (scriptEngine);
@@ -268,8 +268,8 @@ ll::Expected<> PluginManager::unload(std::string_view name) {
268268 LLSERemoveCmdCallback (scriptEngine);
269269 LLSERemoveAllExportedFuncs (scriptEngine);
270270
271+ EngineOwnData::clearEngineObjects (scriptEngine);
271272 EngineManager::unregisterEngine (scriptEngine);
272- scriptEngine->getData ().reset ();
273273
274274 if (auto plugin = std::static_pointer_cast<Plugin>(getMod (name))) {
275275 plugin->onUnload ();
You can’t perform that action at this time.
0 commit comments