From 63bed529c78ca05d3e32a0b6ec3bcfd6152e53de Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 29 Jun 2011 23:52:17 +0300 Subject: Fix memory leak in desktop.cpp --- src/gui/widgets/desktop.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/gui') diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index f7183553f..6ba6477d6 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -38,8 +38,8 @@ #include "debug.h" -Desktop::Desktop() - : mWallpaper(0) +Desktop::Desktop() : + mWallpaper(0) { addWidgetListener(this); @@ -132,23 +132,15 @@ void Desktop::setBestFittingWallpaper() || nWallPaper->getHeight() != getHeight())) { // We rescale to obtain a fullscreen wallpaper... - Image *newRsclWlPpr = nWallPaper->SDLgetScaledImage( - getWidth(), getHeight()); - std::string idPath = nWallPaper->getIdPath(); + Image *newRsclWlPpr = ResourceManager::getInstance()->getRescaled( + nWallPaper, getWidth(), getHeight()); // We replace the resource in the resource manager nWallPaper->decRef(); if (newRsclWlPpr) - { - ResourceManager::getInstance()->addResource( - idPath, newRsclWlPpr); - mWallpaper = newRsclWlPpr; - } else - { mWallpaper = nWallPaper; - } } else { -- cgit v1.2.3-70-g09d2