Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 5 files). Show all
Unified · Split
| @@ -627,6 +627,9 @@ void ScriptEngine::init() { · 626 unmodified lines | ||
| 627 | 627 | qScriptRegisterMetaType(this, qWSCloseCodeToScriptValue, qWSCloseCodeFromScriptValue); |
| 628 | 628 | qScriptRegisterMetaType(this, wscReadyStateToScriptValue, wscReadyStateFromScriptValue); |
| 629 | 629 | |
| 630 | + // NOTE: You do not want to end up creating new instances of singletons here. They will be on the ScriptEngine thread | |
| 631 | + // and are likely to be unusable if we "reset" the ScriptEngine by creating a new one (on a whole new thread). | |
| 632 | + | |
| 630 | 633 | registerGlobalObject("Script", this); |
| 631 | 634 | |
| 632 | 635 | { |
| @@ -638,7 +641,8 @@ void ScriptEngine::init() { · 5 unmodified lines | ||
| 638 | 641 | resetModuleCache(); |
| 639 | 642 | } |
| 640 | 643 | |
| 641 | − registerGlobalObject("Audio", &AudioScriptingInterface::getInstance()); | |
| 644 | + registerGlobalObject("Audio", DependencyManager::get<AudioScriptingInterface>().data()); | |
| 645 | + | |
| 642 | 646 | registerGlobalObject("Entities", entityScriptingInterface.data()); |
| 643 | 647 | registerGlobalObject("Quat", &_quatLibrary); |
| 644 | 648 | registerGlobalObject("Vec3", &_vec3Library); |