Assign editor->map to nullptr after clearing map cache

This commit is contained in:
GriffinR
2020-06-06 09:51:36 -04:00
committed by huderlem
parent c382190e8b
commit afb157beb3
4 changed files with 8 additions and 0 deletions

View File

@@ -326,6 +326,7 @@ bool MainWindow::openProject(QString dir) {
editor->closeProject();
editor->project = new Project(this);
QObject::connect(editor->project, SIGNAL(reloadProject()), this, SLOT(on_action_Reload_Project_triggered()));
QObject::connect(editor->project, SIGNAL(mapCacheCleared()), this, SLOT(onMapCacheCleared()));
QObject::connect(editor->project, &Project::uncheckMonitorFilesAction, [this] () { ui->actionMonitor_Project_Files->setChecked(false); });
on_actionMonitor_Project_Files_triggered(porymapConfig.getMonitorFiles());
editor->project->set_root(dir);
@@ -2217,6 +2218,10 @@ void MainWindow::onMapNeedsRedrawing() {
redrawMapScene();
}
void MainWindow::onMapCacheCleared() {
editor->map = nullptr;
}
void MainWindow::onTilesetsSaved(QString primaryTilesetLabel, QString secondaryTilesetLabel) {
this->editor->updatePrimaryTileset(primaryTilesetLabel, true);
this->editor->updateSecondaryTileset(secondaryTilesetLabel, true);

View File

@@ -143,6 +143,7 @@ void Project::clearMapCache() {
Map *map = mapCache->take(mapName);
if (map) delete map;
}
emit mapCacheCleared();
}
void Project::clearTilesetCache() {