Fix crash when unloading layers; Fix issue accidentally unloading an asset too early

This commit is contained in:
Alexander Bock
2022-01-26 22:57:51 +01:00
committed by Alexander Bock
parent 8070c307ce
commit 2cf268abf0
2 changed files with 2 additions and 2 deletions

View File

@@ -185,7 +185,6 @@ void LayerGroup::deleteLayer(const std::string& layerName) {
std::string name = layerName;
removePropertySubOwner(it->get());
(*it)->deinitialize();
_layers.erase(it);
properties::PropertyOwner* layerGroup = it->get()->owner();
properties::PropertyOwner* layerManager = layerGroup->owner();
properties::PropertyOwner* globe = layerManager->owner();
@@ -195,6 +194,7 @@ void LayerGroup::deleteLayer(const std::string& layerName) {
layerGroup->identifier(),
it->get()->identifier()
);
_layers.erase(it);
update();
if (_onChangeCallback) {
_onChangeCallback(nullptr);

View File

@@ -127,8 +127,8 @@ void AssetManager::deinitialize() {
for (Asset* asset : _rootAssets) {
if (!asset->hasInitializedParent()) {
asset->deinitialize();
asset->unload();
}
asset->unload();
}
_toBeDeleted.clear();
}