logic: crash fixes
<description>
This commit is contained in:
+24
-14
@@ -64,20 +64,7 @@ void Application::loadProject(const std::string& projectSettingsFilePath)
|
||||
m_project->loadProjectSettings(projectSettingsFilePath);
|
||||
m_project->parseCode();
|
||||
|
||||
std::vector<std::string> recentProjects = ApplicationSettings::getInstance()->getRecentProjects();
|
||||
if (recentProjects.size())
|
||||
{
|
||||
recentProjects.erase(std::find(recentProjects.begin(), recentProjects.end(), projectSettingsFilePath));
|
||||
}
|
||||
|
||||
recentProjects.insert(recentProjects.begin(), projectSettingsFilePath);
|
||||
if (recentProjects.size() > 7)
|
||||
{
|
||||
recentProjects.pop_back();
|
||||
}
|
||||
|
||||
ApplicationSettings::getInstance()->setRecentProjects(recentProjects);
|
||||
ApplicationSettings::getInstance()->save("data/ApplicationSettings.xml");
|
||||
updateRecentProjects(projectSettingsFilePath);
|
||||
}
|
||||
|
||||
void Application::loadSource(const std::string& sourceDirectoryPath)
|
||||
@@ -176,3 +163,26 @@ void Application::handleMessage(MessageSaveProject* message)
|
||||
{
|
||||
saveProject(message->projectSettingsFilePath);
|
||||
}
|
||||
|
||||
void Application::updateRecentProjects(const std::string& projectSettingsFilePath)
|
||||
{
|
||||
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
|
||||
std::vector<std::string> recentProjects = appSettings->getRecentProjects();
|
||||
if (recentProjects.size())
|
||||
{
|
||||
std::vector<std::string>::iterator it = std::find(recentProjects.begin(), recentProjects.end(), projectSettingsFilePath);
|
||||
if (it != recentProjects.end())
|
||||
{
|
||||
recentProjects.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
recentProjects.insert(recentProjects.begin(), projectSettingsFilePath);
|
||||
if (recentProjects.size() > 7)
|
||||
{
|
||||
recentProjects.pop_back();
|
||||
}
|
||||
|
||||
appSettings->setRecentProjects(recentProjects);
|
||||
appSettings->save("data/ApplicationSettings.xml");
|
||||
}
|
||||
|
||||
@@ -43,6 +43,8 @@ private:
|
||||
virtual void handleMessage(MessageRefresh* message);
|
||||
virtual void handleMessage(MessageSaveProject* message);
|
||||
|
||||
void updateRecentProjects(const std::string& projectSettingsFilePath);
|
||||
|
||||
std::shared_ptr<Project> m_project;
|
||||
std::shared_ptr<StorageCache> m_storageCache;
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ std::set<FilePath> Storage::getDependingFilePathsAndRemoveFileNodes(const std::s
|
||||
{
|
||||
Node* fileNode = findFileNode(filePath);
|
||||
|
||||
if (!fileNode->getComponent<TokenComponentFilePath>() ||
|
||||
if (!fileNode || !fileNode->getComponent<TokenComponentFilePath>() ||
|
||||
fileNode->getComponent<TokenComponentFilePath>()->getFilePath() != filePath)
|
||||
{
|
||||
LOG_ERROR("Node is not resolving to the same file.");
|
||||
|
||||
Reference in New Issue
Block a user