From 64519c3ffb855c4b6ff6f428ba29173217327306 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 16 Jan 2014 02:22:35 +0300 Subject: delete from cache background image if it unused. --- src/gui/widgets/desktop.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 8ccfcb982..2be86f615 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -159,9 +159,10 @@ void Desktop::setBestFittingWallpaper() if (nWallPaper) { + ResourceManager *const resman = ResourceManager::getInstance(); if (mWallpaper) { - mWallpaper->decRef(); + resman->moveToDeleted(mWallpaper); mWallpaper = nullptr; } @@ -174,13 +175,13 @@ void Desktop::setBestFittingWallpaper() || nWallPaper->getHeight() != height)) { // We rescale to obtain a fullscreen wallpaper... - Image *const newRsclWlPpr = ResourceManager::getInstance() - ->getRescaled(nWallPaper, width, height); + Image *const newRsclWlPpr = resman->getRescaled( + nWallPaper, width, height); if (newRsclWlPpr) { + resman->moveToDeleted(nWallPaper); // We replace the resource in the resource manager - nWallPaper->decRef(); mWallpaper = newRsclWlPpr; } else -- cgit v1.2.3-70-g09d2