uifw/EikStd/coctlsrc/AknButton.cpp
branchRCL_3
changeset 21 978afdc0236f
parent 20 d48ab3b357f1
--- a/uifw/EikStd/coctlsrc/AknButton.cpp	Wed Sep 01 12:16:19 2010 +0100
+++ b/uifw/EikStd/coctlsrc/AknButton.cpp	Tue Sep 14 21:48:24 2010 +0300
@@ -170,16 +170,16 @@
             {
             CGulIcon* newIcon = CGulIcon::NewLC();
             CFbsBitmap* newPic = new ( ELeave ) CFbsBitmap;
-            CleanupStack::PushL( newPic );
             
             newPic->Duplicate( aIcon->Bitmap()->Handle() );
-            newIcon->SetBitmap( newPic );
+            //newPic ownership is transferred to newIcon
+            newIcon->SetBitmap( newPic );            
 
             CFbsBitmap* newMask = new ( ELeave ) CFbsBitmap;
+            CleanupStack::PushL( newMask );
             
             User::LeaveIfError( newMask->Create( 
                 newIcon->Bitmap()->SizeInPixels(), EGray256 ) );
-            CleanupStack::PushL( newMask );
                
             CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( newMask );
             CleanupStack::PushL( bitmapDevice );
@@ -212,7 +212,7 @@
             ReplaceIconStatic( aDimmedIcon, newIcon, aScaleMode );
                                
             CleanupStack::PopAndDestroy( 2 ); // bitmapDevice, bitGc
-            CleanupStack::Pop( 3 ); // newIcon, newPic, newMask
+            CleanupStack::Pop( 2 ); // newIcon, newMask
             }
         }
     }
@@ -2307,9 +2307,9 @@
             {
             return;
             }            
-        
-        if ( ( iFlags & KAknButtonHitTest ) && 
-             !HitAreaContainsL( aPointerEvent.iPosition, EFalse ) )
+        TBool hitArea( EFalse );
+        TRAP_IGNORE( hitArea = HitAreaContainsL( aPointerEvent.iPosition, EFalse ))
+        if ( ( iFlags & KAknButtonHitTest ) && !hitArea )
             {
             buttonEvent = EFalse;
             }