From 9e848f19fdd5f146bfa18a756fe488ccbd71be9c Mon Sep 17 00:00:00 2001 From: David Tardon Date: Tue, 17 May 2011 12:45:43 +0200 Subject: avoid memory leak --- sfx2/source/appl/shutdowniconunx.cxx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/shutdowniconunx.cxx b/sfx2/source/appl/shutdowniconunx.cxx index d8c33ecbb67a..5e70016d1ff1 100644 --- a/sfx2/source/appl/shutdowniconunx.cxx +++ b/sfx2/source/appl/shutdowniconunx.cxx @@ -90,10 +90,10 @@ static GdkPixbuf * ResIdToPixbuf( sal_uInt16 nResId ) Bitmap pInSalBitmap = aIcon.GetBitmap(); AlphaMask pInSalAlpha = aIcon.GetAlpha(); - BitmapReadAccess* pSalBitmap = pInSalBitmap.AcquireReadAccess(); - BitmapReadAccess* pSalAlpha = pInSalAlpha.AcquireReadAccess(); + Bitmap::ScopedReadAccess pSalBitmap(pInSalBitmap); + AlphaMask::ScopedReadAccess pSalAlpha(pInSalAlpha); - g_return_val_if_fail( pSalBitmap != NULL, NULL ); + g_return_val_if_fail( pSalBitmap, NULL ); Size aSize( pSalBitmap->Width(), pSalBitmap->Height() ); if (pSalAlpha) @@ -123,10 +123,6 @@ static GdkPixbuf * ResIdToPixbuf( sal_uInt16 nResId ) } } - pInSalBitmap.ReleaseAccess( pSalBitmap ); - if( pSalAlpha ) - pInSalAlpha.ReleaseAccess( pSalAlpha ); - return gdk_pixbuf_new_from_data( pPixbufData, GDK_COLORSPACE_RGB, sal_True, 8, aSize.Width(), aSize.Height(), -- cgit