From 334f0bb0273432ce12325f479851ee6adf0fef32 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 28 Feb 2013 06:51:07 +0000 Subject: [PATCH] Fix segfault on close --- source/backend/engine/CarlaEngine.cpp | 36 ++++++++------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index 846864600..a1cd72447 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -985,40 +985,24 @@ bool CarlaEngine::loadProject(const char* const filename) return false; } - std::vector saveStates; + QDomNode node(xmlNode.firstChild()); + while (! node.isNull()) { - QDomNode node(xmlNode.firstChild()); - - while (! node.isNull()) + if (node.toElement().tagName() == "Plugin") { - if (node.toElement().tagName() == "Plugin") + const SaveState& saveState = getSaveStateDictFromXML(node); + + // TODO - proper find&load plugins + if (addPlugin(getPluginTypeFromString(saveState.type), saveState.binary, saveState.name, saveState.label, nullptr)) { - const SaveState& saveState = getSaveStateDictFromXML(node); - saveStates.push_back(saveState); + if (CarlaPlugin* plugin = getPlugin(kData->curPluginCount-1)) + plugin->loadSaveState(saveState); } - - node = node.nextSibling(); - } - } - - // TODO - proper find&load plugins - - for (auto it = saveStates.begin(); it != saveStates.end(); ++it) - { - SaveState& saveState(*it); - - if (addPlugin(getPluginTypeFromString(saveState.type), saveState.binary, saveState.name, saveState.label, nullptr)) - { - if (CarlaPlugin* plugin = getPlugin(kData->curPluginCount-1)) - plugin->loadSaveState(saveState); } - - saveState.reset(); + node = node.nextSibling(); } - saveStates.clear(); - return true; }