summaryrefslogtreecommitdiff
path: root/src/gui/widgets/desktop.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-25 16:27:27 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-25 16:27:27 +0300
commit3199384107eb2a6efcca80ed1fefb51df86f87a7 (patch)
tree791d5723b86612eac54d39f72d05798078626358 /src/gui/widgets/desktop.cpp
parent735a20bc923d0a7bf4b0ca0e4d005413ca8de0f8 (diff)
downloadplus-3199384107eb2a6efcca80ed1fefb51df86f87a7.tar.gz
plus-3199384107eb2a6efcca80ed1fefb51df86f87a7.tar.bz2
plus-3199384107eb2a6efcca80ed1fefb51df86f87a7.tar.xz
plus-3199384107eb2a6efcca80ed1fefb51df86f87a7.zip
fix crash with missing resized image in desktop.
Diffstat (limited to 'src/gui/widgets/desktop.cpp')
-rw-r--r--src/gui/widgets/desktop.cpp11
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
{