MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / newAppInstanceInternal

Method newAppInstanceInternal

Engine/AppManager.cpp:1120–1164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1118}
1119
1120AppInstancePtr
1121AppManager::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
1166AppInstancePtr
1167AppManager::newBackgroundInstance(const CLArgs& cl,

Callers

nothing calls this directly

Calls 5

toStdStringMethod · 0.80
push_backMethod · 0.45
getAppIDMethod · 0.45
loadMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected