imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp
branchRCL_3
changeset 24 f0aa341a25bf
parent 20 ffb2d5dd62e9
child 28 ff2fb7658ff7
equal deleted inserted replaced
21:ad31f4183ddc 24:f0aa341a25bf
    37 // ---------------------------------------------------------------------------
    37 // ---------------------------------------------------------------------------
    38 // CThumbnailImageDecoder::CThumbnailImageDecoder()
    38 // CThumbnailImageDecoder::CThumbnailImageDecoder()
    39 // C++ default constructor can NOT contain any code, that might leave.
    39 // C++ default constructor can NOT contain any code, that might leave.
    40 // ---------------------------------------------------------------------------
    40 // ---------------------------------------------------------------------------
    41 //
    41 //
    42 CThumbnailImageDecoderv3::CThumbnailImageDecoderv3( RFs& aFs ): CActive(
    42 CThumbnailImageDecoderv3::CThumbnailImageDecoderv3( RFs& aFs ): 
    43     EPriorityStandard ), iFs( aFs )
    43     CActive(EPriorityStandard ), iBitmap( NULL ), iFs( aFs ), iBuffer( NULL )
    44     {
    44     {
    45     CActiveScheduler::Add( this );
    45     CActiveScheduler::Add( this );
    46     }
    46     }
    47 
    47 
    48 
    48 
   156 // -----------------------------------------------------------------------------
   156 // -----------------------------------------------------------------------------
   157 //
   157 //
   158 void CThumbnailImageDecoderv3::Release()
   158 void CThumbnailImageDecoderv3::Release()
   159     {
   159     {
   160     Cancel();
   160     Cancel();
       
   161     
   161     delete iDecoder;
   162     delete iDecoder;
   162     iDecoder = NULL;
   163     iDecoder = NULL;
       
   164     
       
   165     delete iBitmap;
       
   166     iBitmap = NULL;
       
   167     delete iBuffer; // we own the buffer
       
   168     iBuffer = NULL;
   163     }
   169     }
   164 
   170 
   165 
   171 
   166 // -----------------------------------------------------------------------------
   172 // -----------------------------------------------------------------------------
   167 // CThumbnailImageDecoderv3::DoCancel()
   173 // CThumbnailImageDecoderv3::DoCancel()
   173         {
   179         {
   174         iDecoder->Cancel();
   180         iDecoder->Cancel();
   175         delete iDecoder;
   181         delete iDecoder;
   176         iDecoder = NULL;
   182         iDecoder = NULL;
   177         }
   183         }
       
   184     
       
   185     delete iBitmap;
       
   186     iBitmap = NULL;
       
   187     delete iBuffer; // we own the buffer
       
   188     iBuffer = NULL;
   178     }
   189     }
   179 
   190 
   180 
   191 
   181 // -----------------------------------------------------------------------------
   192 // -----------------------------------------------------------------------------
   182 // CThumbnailImageDecoderv3::RunL()
   193 // CThumbnailImageDecoderv3::RunL()
   186     {
   197     {
   187     // This call takes ownership of iBitmap
   198     // This call takes ownership of iBitmap
   188     iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, EFalse, EFalse );
   199     iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, EFalse, EFalse );
   189 
   200 
   190     iBitmap = NULL; // owned by server now
   201     iBitmap = NULL; // owned by server now
   191     delete iBuffer;
   202     delete iBuffer; // we own the buffer
   192     iBuffer = NULL;
   203     iBuffer = NULL;
       
   204     
   193     Release();
   205     Release();
   194     }
   206     }
   195 
   207 
   196 
   208 
   197 // -----------------------------------------------------------------------------
   209 // -----------------------------------------------------------------------------