File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -154,25 +154,28 @@ void loadConfig(const ll::mod::NativeMod& self, Config& cfg) {
154154
155155void loadDebugEngine (const ll::mod::NativeMod& self) {
156156#ifndef LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS // NodeJs backend didn't enable debug engine now
157- auto & scriptEngine = * EngineManager::newEngine ();
157+ auto scriptEngine = EngineManager::newEngine ();
158158
159159 script::EngineScope engineScope (scriptEngine);
160160
161+ // Init plugin instance for debug engine to prevent something unexpected.
161162 ll::mod::Manifest manifest;
162163 manifest.name = " DebugEngine" ;
163164 getEngineOwnData ()->plugin = std::make_shared<lse::Plugin>(manifest);
165+ // Init logger
166+ getEngineOwnData ()->logger = ll::io::LoggerRegistry::getInstance ().getOrCreate (" DebugEngine" );
164167
165- BindAPIs (& scriptEngine);
168+ BindAPIs (scriptEngine);
166169
167170 // Load BaseLib.
168171 auto baseLibPath = self.getModDir () / " baselib" / BaseLibFileName;
169172 auto baseLibContent = ll::file_utils::readFile (baseLibPath);
170173 if (!baseLibContent) {
171174 throw std::runtime_error (" Failed to read BaseLib at {0}" _tr (baseLibPath.string ()));
172175 }
173- scriptEngine. eval (baseLibContent.value ());
176+ scriptEngine-> eval (baseLibContent.value ());
174177
175- debugEngine = & scriptEngine;
178+ debugEngine = scriptEngine;
176179#endif
177180}
178181
You can’t perform that action at this time.
0 commit comments