@@ -255,16 +255,18 @@ ll::Expected<> PluginManager::unload(std::string_view name) {
255
255
return ll::makeStringError (" Plugin {0} not found" _tr (name));
256
256
}
257
257
258
+ {
259
+ EngineScope scope (scriptEngine);
258
260
#ifndef LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS
259
- LLSERemoveTimeTaskData (scriptEngine);
261
+ LLSERemoveTimeTaskData (scriptEngine);
260
262
#endif
261
- LLSECallEventsOnUnload (scriptEngine);
262
- LLSERemoveAllEventListeners (scriptEngine);
263
- LLSERemoveCmdRegister (scriptEngine);
264
- LLSERemoveCmdCallback (scriptEngine);
265
- LLSERemoveAllExportedFuncs (scriptEngine);
266
-
267
- EngineOwnData::clearEngineObjects (scriptEngine);
263
+ LLSECallEventsOnUnload (scriptEngine);
264
+ LLSERemoveAllEventListeners (scriptEngine);
265
+ LLSERemoveCmdRegister (scriptEngine);
266
+ LLSERemoveCmdCallback (scriptEngine);
267
+ LLSERemoveAllExportedFuncs (scriptEngine);
268
+ EngineOwnData::clearEngineObjects (scriptEngine);
269
+ }
268
270
EngineManager::unregisterEngine (scriptEngine);
269
271
270
272
if (auto plugin = std::static_pointer_cast<Plugin>(getMod (name))) {
@@ -292,7 +294,7 @@ ll::Expected<> PluginManager::unload(std::string_view name) {
292
294
}
293
295
294
296
return {};
295
- } catch (const script::Exception& e ) {
297
+ } catch (const script::Exception&) {
296
298
return ll::makeStringError (" Failed to unload plugin {0}: {1}" _tr (name, " Unknown script exception" ));
297
299
} catch (const std::exception& e) {
298
300
return ll::makeStringError (" Failed to unload plugin {0}: {1}" _tr (name, e.what ()));
0 commit comments