summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-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
{