diff options
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/minimap.cpp | 17 | ||||
-rw-r--r-- | src/gui/windows/minimap.h | 2 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 9be6d7304..70a2361cd 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -89,7 +89,12 @@ Minimap::~Minimap() config.setValue(getWindowName() + "Show", mShow); config.removeListeners(this); CHECKLISTENERS + deleteMapImage(); + delete2(mTextPopup); +} +void Minimap::deleteMapImage() +{ if (mMapImage) { if (mCustomMapImage) @@ -98,7 +103,6 @@ Minimap::~Minimap() mMapImage->decRef(); mMapImage = nullptr; } - delete2(mTextPopup); } void Minimap::setMap(const Map *const map) @@ -115,16 +119,7 @@ void Minimap::setMap(const Map *const map) } setCaption(caption); - - // Adapt the image - if (mMapImage) - { - if (mCustomMapImage) - delete mMapImage; - else - mMapImage->decRef(); - mMapImage = nullptr; - } + deleteMapImage(); if (map) { diff --git a/src/gui/windows/minimap.h b/src/gui/windows/minimap.h index e8fff5144..18a8a0a8b 100644 --- a/src/gui/windows/minimap.h +++ b/src/gui/windows/minimap.h @@ -73,6 +73,8 @@ class Minimap final : public Window, public ConfigListener void optionChanged(const std::string &name); private: + void deleteMapImage(); + float mWidthProportion; float mHeightProportion; Image *mMapImage; |