[Libreoffice-commits] core.git: vcl/source

Thorsten Behrens Thorsten.Behrens at CIB.de
Fri May 6 00:58:13 UTC 2016


 vcl/source/gdi/wall.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit ee5850893e15acda1d7ce7cf17da7c80f2fa810a
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date:   Fri May 6 02:07:56 2016 +0200

    vcl: save one heap alloc
    
    Change-Id: I4557d643debbf47c10e1ccd2141f04680333a11d
    Reviewed-on: https://gerrit.libreoffice.org/24685
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx
index 7f81368..26b3448 100644
--- a/vcl/source/gdi/wall.cxx
+++ b/vcl/source/gdi/wall.cxx
@@ -202,9 +202,10 @@ Wallpaper::~Wallpaper()
 
 void Wallpaper::ImplSetCachedBitmap( BitmapEx& rBmp ) const
 {
-    if( mpImplWallpaper->mpCache )
-        delete const_cast< ImplWallpaper* >(mpImplWallpaper.get())->mpCache;
-    const_cast< ImplWallpaper* >(mpImplWallpaper.get())->mpCache = new BitmapEx( rBmp );
+   if( !mpImplWallpaper->mpCache )
+      const_cast< ImplWallpaper* >(mpImplWallpaper.get())->mpCache = new BitmapEx( rBmp );
+   else
+      *const_cast< ImplWallpaper* >(mpImplWallpaper.get())->mpCache = rBmp;
 }
 
 const BitmapEx* Wallpaper::ImplGetCachedBitmap() const


More information about the Libreoffice-commits mailing list