diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-25 16:27:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-25 16:27:27 +0300 |
commit | 3199384107eb2a6efcca80ed1fefb51df86f87a7 (patch) | |
tree | 791d5723b86612eac54d39f72d05798078626358 | |
parent | 735a20bc923d0a7bf4b0ca0e4d005413ca8de0f8 (diff) | |
download | manaplus-3199384107eb2a6efcca80ed1fefb51df86f87a7.tar.gz manaplus-3199384107eb2a6efcca80ed1fefb51df86f87a7.tar.bz2 manaplus-3199384107eb2a6efcca80ed1fefb51df86f87a7.tar.xz manaplus-3199384107eb2a6efcca80ed1fefb51df86f87a7.zip |
fix crash with missing resized image in desktop.
-rw-r--r-- | src/gui/widgets/desktop.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index bee1c76e6..7daff45f0 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -139,7 +139,10 @@ void Desktop::setBestFittingWallpaper() if (nWallPaper) { if (mWallpaper) + { mWallpaper->decRef(); + mWallpaper = nullptr; + } const gcn::Rectangle &rect = mDimension; const int width = rect.width; @@ -153,12 +156,16 @@ void Desktop::setBestFittingWallpaper() Image *const newRsclWlPpr = ResourceManager::getInstance() ->getRescaled(nWallPaper, width, height); - // We replace the resource in the resource manager - nWallPaper->decRef(); if (newRsclWlPpr) + { + // We replace the resource in the resource manager + nWallPaper->decRef(); mWallpaper = newRsclWlPpr; + } else + { mWallpaper = nWallPaper; + } } else { |