imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp
branchRCL_3
changeset 24 f0aa341a25bf
parent 20 ffb2d5dd62e9
child 38 2b4b06654caa
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp	Wed Jun 09 10:01:32 2010 +0300
@@ -52,8 +52,9 @@
 // C++ default constructor can NOT contain any code, that might leave.
 // ---------------------------------------------------------------------------
 //
-CThumbnailImageDecoder::CThumbnailImageDecoder( RFs& aFs ): CActive(
-    EPriorityStandard ), iFs( aFs )
+CThumbnailImageDecoder::CThumbnailImageDecoder( RFs& aFs ): 
+    CActive(EPriorityStandard ), iBitmap( NULL ), iJpegReadBuffer( NULL ),  
+    iExifThumbImage( NULL ), iFs( aFs ), iBuffer( NULL )
     {
     CActiveScheduler::Add( this );
     }
@@ -248,12 +249,18 @@
 void CThumbnailImageDecoder::Release()
     {
     Cancel();
+   
+    delete iDecoder;
+    iDecoder = NULL;
+    
+    delete iBitmap;
+    iBitmap = NULL;
     delete iJpegReadBuffer;
     iJpegReadBuffer = NULL;
     delete iExifThumbImage;
     iExifThumbImage = NULL;
-    delete iDecoder;
-    iDecoder = NULL;
+    
+    iBuffer = NULL; // we don't own the buffer
     }
 
 
@@ -266,13 +273,18 @@
     if ( iDecoder )
         {
         iDecoder->Cancel();
-        delete iJpegReadBuffer;
-        iJpegReadBuffer = NULL;
-        delete iExifThumbImage;
-        iExifThumbImage = NULL;
         delete iDecoder;
         iDecoder = NULL;
         }
+    
+    delete iBitmap;
+    iBitmap = NULL;
+    delete iJpegReadBuffer;
+    iJpegReadBuffer = NULL;
+    delete iExifThumbImage;
+    iExifThumbImage = NULL;
+    
+    iBuffer = NULL; // we don't own the buffer
     }
 
 
@@ -286,6 +298,8 @@
     iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, iEXIF, iPortrait );
 
     iBitmap = NULL; // owned by server now
+    iBuffer = NULL; // we don't own the buffer
+    
     Release();
     }
 
@@ -570,8 +584,7 @@
             CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionAlwaysThread );
         }
 
-    TRAPD( err, iDecoder = CExtJpegDecoder::DataNewL( iFs, * iExifThumbImage,
-        options ));
+    TRAPD( err, iDecoder = CExtJpegDecoder::DataNewL( iFs, * iExifThumbImage, options ));
 
     if ( err == KErrNotFound || err == KErrNotSupported )
         {