|
@@ -1215,7 +1215,11 @@ json_t* Engine::toJson() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Engine::fromJson(json_t* rootJ) { |
|
|
void Engine::fromJson(json_t* rootJ) { |
|
|
|
|
|
clear(); |
|
|
|
|
|
|
|
|
// modules |
|
|
// modules |
|
|
|
|
|
// We can't instantiate modules before clearing because some modules add ParamHandles upon construction. |
|
|
|
|
|
// We also can't lock while instantiating modules because they call addParamHandle() which locks. |
|
|
std::vector<Module*> modules; |
|
|
std::vector<Module*> modules; |
|
|
json_t* modulesJ = json_object_get(rootJ, "modules"); |
|
|
json_t* modulesJ = json_object_get(rootJ, "modules"); |
|
|
if (!modulesJ) |
|
|
if (!modulesJ) |
|
@@ -1257,8 +1261,6 @@ void Engine::fromJson(json_t* rootJ) { |
|
|
|
|
|
|
|
|
std::lock_guard<SharedMutex> lock(internal->mutex); |
|
|
std::lock_guard<SharedMutex> lock(internal->mutex); |
|
|
|
|
|
|
|
|
clear_NoLock(); |
|
|
|
|
|
|
|
|
|
|
|
// Add modules |
|
|
// Add modules |
|
|
for (Module* module : modules) { |
|
|
for (Module* module : modules) { |
|
|
addModule_NoLock(module); |
|
|
addModule_NoLock(module); |
|
|