Revision: 201020 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 09 Jun 2010 10:01:32 +0300
branchRCL_3
changeset 24 f0aa341a25bf
parent 21 ad31f4183ddc
child 28 ff2fb7658ff7
Revision: 201020 Kit: 2010123
imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h
imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp
imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp
imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp
imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp
imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp
imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h
imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildecodetask.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp
imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp
imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h	Wed Jun 09 10:01:32 2010 +0300
@@ -173,6 +173,9 @@
 _LIT( KM4vExt,  ".m4v" );
 _LIT( KNonEmbeddedArtExt, ".alb" );
 
+_LIT( KPrivateFolder, ":\\private\\");
+_LIT( KSysFolder, ":\\sys\\");
+
 /**
  *  Control flags set by the server for handling specific situations
  *  (for example for distinguishing between preview thumbnails and
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp	Wed Jun 09 10:01:32 2010 +0300
@@ -102,10 +102,6 @@
       User::Leave( KErrNotFound );            
       }
     
-    CleanupStack::Pop( data );
-    CleanupStack::PopAndDestroy(&wantedFields);
-    CleanupStack::PopAndDestroy(metaDataUtil);
-
     if ( !iImageDecoderv3 )
         {
         iImageDecoderv3 = new( ELeave )CThumbnailImageDecoderv3( aFs );
@@ -117,6 +113,11 @@
     iDisplayMode = KStoreDisplayMode;
     
     iImageDecoderv3->CreateL( data, *iObserver, iFlags, iMimeType, iTargetSize );
+    
+    CleanupStack::Pop( data );
+    CleanupStack::PopAndDestroy(&wantedFields);
+    CleanupStack::PopAndDestroy(metaDataUtil);
+    
     iOriginalSize = iImageDecoderv3->OriginalSize();
     iImageDecoderv3->DecodeL( iDisplayMode );
     }
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp	Wed Jun 09 10:01:32 2010 +0300
@@ -39,8 +39,8 @@
 // C++ default constructor can NOT contain any code, that might leave.
 // ---------------------------------------------------------------------------
 //
-CThumbnailImageDecoderv3::CThumbnailImageDecoderv3( RFs& aFs ): CActive(
-    EPriorityStandard ), iFs( aFs )
+CThumbnailImageDecoderv3::CThumbnailImageDecoderv3( RFs& aFs ): 
+    CActive(EPriorityStandard ), iBitmap( NULL ), iFs( aFs ), iBuffer( NULL )
     {
     CActiveScheduler::Add( this );
     }
@@ -158,8 +158,14 @@
 void CThumbnailImageDecoderv3::Release()
     {
     Cancel();
+    
     delete iDecoder;
     iDecoder = NULL;
+    
+    delete iBitmap;
+    iBitmap = NULL;
+    delete iBuffer; // we own the buffer
+    iBuffer = NULL;
     }
 
 
@@ -175,6 +181,11 @@
         delete iDecoder;
         iDecoder = NULL;
         }
+    
+    delete iBitmap;
+    iBitmap = NULL;
+    delete iBuffer; // we own the buffer
+    iBuffer = NULL;
     }
 
 
@@ -188,8 +199,9 @@
     iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, EFalse, EFalse );
 
     iBitmap = NULL; // owned by server now
-    delete iBuffer;
+    delete iBuffer; // we own the buffer
     iBuffer = NULL;
+    
     Release();
     }
 
--- 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 )
         {
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp	Wed Jun 09 10:01:32 2010 +0300
@@ -33,8 +33,8 @@
 // C++ default constructor can NOT contain any code, that might leave.
 // ---------------------------------------------------------------------------
 //
-CThumbnailImageDecoderv2::CThumbnailImageDecoderv2( RFs& aFs): CActive(
-    EPriorityStandard ), iFs( aFs )
+CThumbnailImageDecoderv2::CThumbnailImageDecoderv2( RFs& aFs): 
+    CActive(EPriorityStandard ), iBitmap( NULL ), iFs( aFs ), iBuffer( NULL )
     {
     CActiveScheduler::Add( this );
     }
@@ -93,10 +93,7 @@
         }
     
     iDecoder->Convert( &iStatus, * iBitmap );
-    while ( iStatus == KErrUnderflow )
-        {
-        iDecoder->ContinueConvert( &iStatus );
-        }
+
     SetActive();  
     
     TN_DEBUG1( "CThumbnailImageDecoderv2::DecodeL() end" );
@@ -111,8 +108,14 @@
 void CThumbnailImageDecoderv2::Release()
     {
     Cancel();
+    
     delete iDecoder;
     iDecoder = NULL;
+    
+    delete iBitmap;
+    iBitmap = NULL;
+    
+    iBuffer = NULL; // we don't own the buffer
     }
 
 
@@ -128,6 +131,11 @@
         delete iDecoder;
         iDecoder = NULL;
         }
+    
+    delete iBitmap;
+    iBitmap = NULL;
+    
+    iBuffer = NULL; // we don't own the buffer
     }
 
 
@@ -143,7 +151,8 @@
     iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, EFalse, EFalse);
 
     iBitmap = NULL; // owned by server now
-    iBuffer = NULL;
+    iBuffer = NULL; // we don't own the buffer
+    
     Release();
     }
 
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp	Wed Jun 09 10:01:32 2010 +0300
@@ -95,12 +95,6 @@
     iActivityManager = CTMActivityManager::NewL( this, KBackgroundGenerationIdle);
 
     UpdatePSValues(ETrue);
-
-    if(iForegroundGenerationObserver)
-        {
-        delete iForegroundGenerationObserver;
-        iForegroundGenerationObserver = NULL;
-        }
     
     RProperty::Define(KTAGDPSNotification, KMPXHarvesting, RProperty::EInt);
     
@@ -167,6 +161,12 @@
         iForegroundGenerationObserver = NULL;
         }
     
+    if(iFormatObserver)
+        {
+        delete iFormatObserver;
+        iFormatObserver = NULL;
+        }
+    
     if ( iCollectionUtility )
         {
         iCollectionUtility->Close();
@@ -188,8 +188,6 @@
         iTMSession = NULL;
         }
     
-    delete iFormatObserver;
-    
     TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - end" );
     }
 
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp	Wed Jun 09 10:01:32 2010 +0300
@@ -153,7 +153,7 @@
                 iFile.Close();
                 User::LeaveIfError( iFile.Open( iFs, iPath, EFileShareReadersOrWriters ) );  
                 
-                TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iTargetUri );
+                TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iPath );
                 
                 CleanupClosePushL( iFile );
                 iSession.RequestThumbnailL( iFile, iPath, iParamsPckg, iStatus );
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h	Wed Jun 09 10:01:32 2010 +0300
@@ -143,7 +143,7 @@
      * @param aOriginalSize Original size of bitmap.
      */
     void DoBlacklisting( const TInt aError, const TSize& aOriginalSize );
-
+    
 private:
     // Data
 
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h	Wed Jun 09 10:01:32 2010 +0300
@@ -462,6 +462,15 @@
     TBool IsFormatting();
   
     inline CThumbnailFetchedChecker& FetchedChecker() const { return *iFetchedChecker; }
+    
+    /**
+     * Check is path in public folder
+     *
+     * @param aPath
+     * @ret 
+     */
+    TBool IsPublicPath( const TDesC& aPath );
+    
 protected: // Functions from base classes
 
     /**
@@ -528,7 +537,7 @@
      * @since S60 v5.0
      */
     static TInt ReconnectCallBack(TAny* aAny);
-
+    
 private:
 
     /**
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildecodetask.cpp	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildecodetask.cpp	Wed Jun 09 10:01:32 2010 +0300
@@ -51,6 +51,7 @@
 //
 CThumbnailDecodeTask::~CThumbnailDecodeTask()
     {
+    TN_DEBUG2( "CThumbnailDecodeTask(0x%08x)::~CThumbnailDecodeTask()", this );
     if ( iProvider )
         {
         iProvider->CancelGetThumbnail();
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp	Wed Jun 09 10:01:32 2010 +0300
@@ -124,8 +124,7 @@
 #ifdef _DEBUG
     aStart.UniversalTime();
 #endif
-
-      
+   
     TParsePtrC parse(iFilename);
     TPtrC ext(parse.Ext());
     TBuf8< KMaxDataTypeLength > mimeType;                
@@ -357,19 +356,21 @@
                     }
                 }
             
-            CThumbnailScaleTask* scaleTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename,
+            CThumbnailScaleTask* complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename,
                 aBitmap, iOriginalSize, (*iMissingSizes)[ i ].iSize, (*iMissingSizes)[ i ].iCrop, iDisplayMode,
                 KMaxPriority, iTargetUri, (*iMissingSizes)[ i ].iType, iModified, iScaledBitmapToPool, iEXIF,
                 iRequestId);
-            CleanupStack::PushL( scaleTask );
+            CleanupStack::PushL( complTask );
             
             TInt err1 = KErrNone;
             TInt err2 = KErrNone;
+            
             if(iFilename != KNullDesC)
                 {
                 TRAP(err1, iServer.StoreForPathL(iFilename));
                 }
-            if(iTargetUri != KNullDesC)
+            
+            if(iTargetUri != KNullDesC )
                 {
                 TRAP(err2, iServer.StoreForPathL(iTargetUri));
                 }
@@ -379,22 +380,30 @@
                     (*iMissingSizes)[ i ].iType == ECustomThumbnailSize || 
                     (*iMissingSizes)[ i ].iType == EUnknownThumbnailSize )
                 {
-                scaleTask->SetDoStore( EFalse );
+                complTask->SetDoStore( EFalse );
                 TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this );
                 }
             else
                 {
-                scaleTask->SetDoStore( ETrue );
+                if(iFilename != KNullDesC)
+                    {
+                    complTask->SetDoStore(iServer.IsPublicPath( iFilename ));
+                    }
+                
+                if(iTargetUri != KNullDesC)
+                    {
+                    complTask->SetDoStore(iServer.IsPublicPath( iTargetUri ));
+                    }
                 }
             
-            iProcessor.AddTaskL( scaleTask );
-            CleanupStack::Pop( scaleTask );
+            iProcessor.AddTaskL( complTask );
+            CleanupStack::Pop( complTask );
             
             // completion to first task, because task processor works like stack
             if( i == 0 )
                 {
                 // compTask is now responsible for completing the RMessage
-                scaleTask->SetMessageData( iRequestId, iMessage, iClientThread );
+                complTask->SetMessageData( iRequestId, iMessage, iClientThread );
                 ResetMessageData();
                 }
             }
@@ -441,7 +450,15 @@
             }
         else
             {
-            complTask->SetDoStore( ETrue );
+            if(iFilename != KNullDesC)
+                {
+                complTask->SetDoStore(iServer.IsPublicPath( iFilename ));
+                }
+             
+             if(iTargetUri != KNullDesC)
+                {
+                complTask->SetDoStore(iServer.IsPublicPath( iTargetUri ));
+                }
             }
         
         iProcessor.AddTaskL( complTask );
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp	Wed Jun 09 10:01:32 2010 +0300
@@ -1640,3 +1640,28 @@
     return KErrNone;
     }
 
+// -----------------------------------------------------------------------------
+// CThumbnailServer::IsPublicPath
+// -----------------------------------------------------------------------------
+//
+
+TBool CThumbnailServer::IsPublicPath( const TDesC& aPath )
+    {
+    TInt pos = aPath.FindF(KPrivateFolder);
+    
+    if ( pos == 1 )
+        {
+        TN_DEBUG1( "CThumbnailServer::IsPublicPath() NO");
+        return EFalse;
+        }
+    
+    pos = aPath.FindF(KSysFolder);
+    if ( pos == 1 )
+        {
+        TN_DEBUG1( "CThumbnailServer::IsPublicPath() NO");
+        return EFalse;
+        }
+    
+    return ETrue;
+    }
+
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp	Wed Jun 09 10:01:32 2010 +0300
@@ -1068,7 +1068,7 @@
     const TSize& aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags, 
 	const TThumbnailSize& aThumbnailSize, const TInt64 aModified, const TBool aThumbFromPath )
     {
-    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( const TDes8& ) in" );
+    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) in" );
 
 #ifdef _DEBUG
     TTime aStart, aStop;
@@ -1131,7 +1131,7 @@
     // try getting modification time from file
     TTime timeStamp;
     
-    TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() timeStamp aModified %Ld", aModified );
+    TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp aModified %Ld", aModified );
         
     if( aModified )
         {
@@ -1153,11 +1153,11 @@
             
             if (timeErr != KErrNone)
                 {
-                TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() error getting timeStamp: %d", timeErr );
+                TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) error getting timeStamp: %d", timeErr );
                 }
             else
                 {
-                TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() timeStamp       iFs %Ld", timeStamp.Int64() );
+                TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp       iFs %Ld", timeStamp.Int64() );
                 }
             }
         
@@ -1165,11 +1165,11 @@
             {
             // otherwise current time
             timeStamp.UniversalTime();
-            TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() timeStamp   current %Ld", timeStamp.Int64() );
+            TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp   current %Ld", timeStamp.Int64() );
             }
         }
         
-   TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() timeStamp       set %Ld", timeStamp.Int64());
+   TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp       set %Ld", timeStamp.Int64());
    
     paramIndex = stmt->ParameterIndex( KThumbnailSqlParamModified );
     User::LeaveIfError( paramIndex );
@@ -1203,9 +1203,9 @@
     TN_DEBUG2( "CThumbnailStore::THUMBSTORE-COUNTER----------, Thumbs = %d", iThumbCounter );
     
     aStop.UniversalTime();
-    TN_DEBUG2( "CThumbnailStore::StoreThumbnailL() insert to table %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
+    TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) insert to table %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
 #endif 
-    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( const TDes8& ) out" );
+    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) out" );
     }
 
 
@@ -1219,7 +1219,7 @@
     const TInt64 aModified, TBool aThumbFromPath, TBool aBlackListed )
     {
     TSize thumbSize = aThumbnail->SizeInPixels();
-    TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( CFbsBitmap ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight );
+    TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight );
 
     __ASSERT_DEBUG(( aThumbnail ), ThumbnailPanic( EThumbnailNullPointer ));
     
@@ -1229,7 +1229,7 @@
     if(aThumbnailSize == ECustomThumbnailSize || aThumbnailSize == EUnknownThumbnailSize 
             || thumbSize.iWidth <= 0 || thumbSize.iHeight <= 0 )
         {
-        TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() not stored");
+        TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) not stored");
         return;
         }
     
@@ -1261,6 +1261,8 @@
             if( (aThumbnailSize == EImageFullScreenThumbnailSize || aThumbnailSize == EVideoFullScreenThumbnailSize ||
                  aThumbnailSize == EAudioFullScreenThumbnailSize) && !aBlackListed )
                 {
+                TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - encode jpg" );
+            
                 HBufC8* data = NULL;
                 CleanupStack::PushL( data );
                 
@@ -1282,9 +1284,8 @@
                 User::LeaveIfError(frameImageData->AppendImageData(imageData));
                 CleanupStack::Pop( imageData );
                 
-                
 #ifdef _DEBUG
-        TN_DEBUG4( "CThumbnailStore::StoreThumbnailL() size %d x %d displaymode %d ", 
+        TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) - size: %d x %d, displaymode: %d ", 
                 aThumbnail->SizeInPixels().iWidth, 
                 aThumbnail->SizeInPixels().iHeight, 
                 aThumbnail->DisplayMode());
@@ -1298,7 +1299,9 @@
                 CleanupStack::PopAndDestroy( encoder );
                 
                 if(request == KErrNone)
-                    {
+                    {           
+                    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - encoding ok" );    
+                
                     CleanupStack::PushL( data );
                     TPtr8 ptr = data->Des(); 
                     StoreThumbnailL( *path, ptr, aThumbnail->SizeInPixels(), 
@@ -1306,6 +1309,10 @@
                                      aThumbnailSize, aModified, aThumbFromPath  );
                     CleanupStack::Pop( data );
                     }
+                else
+                    {
+                    TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - encoding failed: %d", request.Int() );
+                    }
                 
                 delete data;
                 data = NULL;
@@ -1331,7 +1338,7 @@
     
     CleanupStack::PopAndDestroy( path );
     
-    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( CFbsBitmap* ) out" );
+    TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) out" );
     }
 
 // ---------------------------------------------------------------------------
@@ -2212,6 +2219,8 @@
         // thumbmnail deletion
         if (self->iDeleteThumbs)
             {
+            TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - cleanup");
+        
             TInt deleteCount = 0;
             
             // delete marked rows from database
@@ -2233,6 +2242,8 @@
         // file existence check
         else if (self->iCheckFilesExist)
             {
+            TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - file existence check");
+        
             TBool finished = EFalse;
         
             TRAPD( err, finished = self->FileExistenceCheckL() );
@@ -2253,10 +2264,13 @@
         // next round
         if (self->iIdle && ( self->iDeleteThumbs || self->iCheckFilesExist) )
             {
+            TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - continue maintenance");
             self->StartMaintenance();
             }  
         else if (!self->iDeleteThumbs && !self->iCheckFilesExist)
             {
+            TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - no more maintenance");
+        
             // no need to monitor activity anymore
             self->iActivityManager->Cancel();
             }
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp	Wed Jun 09 10:01:32 2010 +0300
@@ -351,13 +351,13 @@
                     }
                 }
             
-            if ( processingDaemonTasksOnly && task->GetMessageData().Handle())
+            if ( processingDaemonTasksOnly && task->ClientThreadAlive() )
                 {
-                    if(task->GetMessageData().Identity() != KDaemonUid )
-                        {
-                        TN_DEBUG1( "CThumbnailTaskProcessor::RunL() processingDaemonTasksOnly = EFalse" );
-                        processingDaemonTasksOnly = EFalse; 
-                        }
+                if(task->GetMessageData().Identity() != KDaemonUid )
+                    {
+                    TN_DEBUG1( "CThumbnailTaskProcessor::RunL() processingDaemonTasksOnly = EFalse" );
+                    processingDaemonTasksOnly = EFalse; 
+                    }
                 }
             }
         }
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp	Tue May 25 13:01:47 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp	Wed Jun 09 10:01:32 2010 +0300
@@ -25,6 +25,7 @@
 CTMActivityManager* CTMActivityManager::NewL(MTMActivityManagerObserver* aObserver, TInt aTimeout)
     {
     TN_DEBUG1( "CTMActivityManager::NewL()");
+    
     CTMActivityManager* self = new (ELeave) CTMActivityManager(aObserver, aTimeout);
     CleanupStack::PushL(self);
     self->ConstructL();
@@ -40,6 +41,7 @@
 : CActive(CActive::EPriorityHigh), iObserver(aObserver), iTimeout(aTimeout), iPreviousStatus(KErrNotFound)
     {
     TN_DEBUG1( "CTMActivityManager::CTMActivityManager()");
+    
     CActiveScheduler::Add(this);
     }
 
@@ -50,10 +52,12 @@
 CTMActivityManager::~CTMActivityManager()
     {
     TN_DEBUG1( "CTMActivityManager::~CTMActivityManager()");
+    
 #ifdef MONITOR_LIGHTS
     delete iLight;
     iLight = NULL;
 #endif
+    
     Cancel();
     iTimer.Close();
     }
@@ -65,6 +69,7 @@
 void CTMActivityManager::ConstructL()
     {
     TN_DEBUG1( "CTMActivityManager::ConstructL()");
+    
     iTimer.CreateLocal();
     iWatch = ENone;
     }
@@ -76,6 +81,7 @@
 void CTMActivityManager::SetTimeout(TInt aTimeout)
     {
     TN_DEBUG1( "CTMActivityManager::SetTimeout()");
+    
     iTimeout = aTimeout;
     Reset();
     }
@@ -87,10 +93,12 @@
 void CTMActivityManager::Reset()
     {
     TN_DEBUG1( "CTMActivityManager::Reset()");
+
 #ifdef MONITOR_LIGHTS
     delete iLight;
     iLight = NULL;
 #endif
+    
     Cancel();
     Start();
     }
@@ -101,6 +109,12 @@
 void CTMActivityManager::DoCancel()
     {
     TN_DEBUG1( "CTMActivityManager::DoCancel()");
+    
+#ifdef MONITOR_LIGHTS
+    delete iLight;
+    iLight = NULL;
+#endif
+    
     iTimer.Cancel();
     iWatch = ENone;
     }
@@ -279,6 +293,7 @@
 void CTMActivityManager::NotifyObserver()
     {
     TN_DEBUG1( "void CTMAActivityManager::NotifyObserver()");
+    
     TBool status = IsInactive();
     
     if( iPreviousStatus != status )