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

New commits:
commit ee5850893e15acda1d7ce7cf17da7c80f2fa810a
Author: Thorsten Behrens <thorsten.behr...@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 <c...@libreoffice.org>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@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
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to