| 1118 | } |
| 1119 | |
| 1120 | AppInstancePtr |
| 1121 | AppManager::newAppInstanceInternal(const CLArgs& cl, |
| 1122 | bool alwaysBackground, |
| 1123 | bool makeEmptyInstance) |
| 1124 | { |
| 1125 | AppInstancePtr instance; |
| 1126 | |
| 1127 | if (!alwaysBackground) { |
| 1128 | instance = makeNewInstance(_imp->_availableID); |
| 1129 | } else { |
| 1130 | instance = std::make_shared<AppInstance>(_imp->_availableID); |
| 1131 | } |
| 1132 | |
| 1133 | { |
| 1134 | QMutexLocker k(&_imp->_appInstancesMutex); |
| 1135 | _imp->_appInstances.push_back(instance); |
| 1136 | } |
| 1137 | |
| 1138 | setAsTopLevelInstance( instance->getAppID() ); |
| 1139 | |
| 1140 | ++_imp->_availableID; |
| 1141 | |
| 1142 | try { |
| 1143 | instance->load(cl, makeEmptyInstance); |
| 1144 | } catch (const std::exception & e) { |
| 1145 | Dialogs::errorDialog( NATRON_APPLICATION_NAME, e.what(), false ); |
| 1146 | removeInstance(_imp->_availableID); |
| 1147 | instance.reset(); |
| 1148 | --_imp->_availableID; |
| 1149 | |
| 1150 | return instance; |
| 1151 | } catch (...) { |
| 1152 | Dialogs::errorDialog( NATRON_APPLICATION_NAME, tr("Cannot load project").toStdString(), false ); |
| 1153 | removeInstance(_imp->_availableID); |
| 1154 | instance.reset(); |
| 1155 | --_imp->_availableID; |
| 1156 | |
| 1157 | return instance; |
| 1158 | } |
| 1159 | |
| 1160 | ///flag that we finished loading the Appmanager even if it was already true |
| 1161 | _imp->_loaded = true; |
| 1162 | |
| 1163 | return instance; |
| 1164 | } |
| 1165 | |
| 1166 | AppInstancePtr |
| 1167 | AppManager::newBackgroundInstance(const CLArgs& cl, |
nothing calls this directly
no test coverage detected