diff -r b67379558a75 -r c5df59b4ae2d imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Tue Jul 06 14:37:18 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Wed Aug 18 10:05:55 2010 +0300 @@ -416,6 +416,7 @@ "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() out" ); // Comes here if server gets shut down delete server; + server = NULL; CleanupStack::PopAndDestroy( scheduler ); } } @@ -443,7 +444,10 @@ iSessionCount ); iSessionCount--; - iProcessor->RemoveTasks(aSession); + if(iProcessor) + { + iProcessor->RemoveTasks(aSession); + } TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession ); @@ -459,7 +463,7 @@ { TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession ); - delete ref->iBitmap; + delete ref->iBitmap; bpiter.RemoveCurrent(); TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count()); @@ -570,7 +574,7 @@ if( iFetchedChecker ) { - iFetchedChecker->SetFetchResult( aPath, KErrNone ); + iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, KErrNone ); } } @@ -585,7 +589,7 @@ TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize ); if( iFetchedChecker ) { - TInt err( iFetchedChecker->LastFetchResult( aPath ) ); + TInt err( iFetchedChecker->LastFetchResult( aPath, aThumbnailSize ) ); if ( err == KErrNone ) // To avoid useless sql gets that fails for sure { // custom sizes are not stored to db, skip fetching @@ -597,7 +601,7 @@ TRAP( err, StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize) ); if ( err != KErrNone ) { - iFetchedChecker->SetFetchResult( aPath, err ); + iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, err ); } } User::LeaveIfError( err ); @@ -666,7 +670,7 @@ if( iFetchedChecker ) { - iFetchedChecker->SetFetchResult( aPath, KErrNone ); + iFetchedChecker->DeleteFetchResult( aPath ); } } @@ -852,7 +856,7 @@ if ( ref->iSession == aRequestId.iSession && ref->iRequestId == aRequestId.iRequestId ) { - delete ref->iBitmap; + delete ref->iBitmap; bpiter.RemoveCurrent(); TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d", @@ -944,7 +948,7 @@ } else { - if(iFormatting) + if( iFormatting ) { TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - FORMATTING! - ABORT"); User::Leave( KErrNotSupported ); @@ -953,17 +957,31 @@ TVolumeInfo volumeInfo; TInt err = iFs.Volume( volumeInfo, aDrive ); - if ( err || volumeInfo.iDrive.iDriveAtt& KDriveAttRom || - volumeInfo.iDrive.iDriveAtt& KDriveAttRemote || - volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected || - volumeInfo.iDrive.iMediaAtt& KMediaAttLocked ) + if ( err ) + { + // Locked + TN_DEBUG2( "CThumbnailServer::StoreForDriveL() - err %d", err); + User::Leave( err); + } + else if( volumeInfo.iDrive.iMediaAtt& KMediaAttLocked ) { - // We don't support ROM disks or remote mounts. Media - // must be read-write and not locked. - User::Leave( KErrAccessDenied); + TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - locked"); + User::Leave( KErrAccessDenied ); } - - res = CThumbnailStore::NewL( iFs, aDrive, iImei, this ); + else if ( volumeInfo.iDrive.iDriveAtt& KDriveAttRom || + volumeInfo.iDrive.iDriveAtt& KDriveAttRemote || + volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected ) + { + // We support ROM disks and remote disks in read only mode. + TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - rom/remote/write protected"); + res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, ETrue ); + } + else + { + TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - normal"); + res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, EFalse ); + } + CleanupStack::PushL( res ); iStores.InsertL( aDrive, res ); res->SetPersistentSizes(iPersistentSizes); @@ -1057,6 +1075,7 @@ if (store) { delete *store; + *store = NULL; iStores.Remove( aDrive ); } } @@ -1145,7 +1164,7 @@ // If drive-list entry is zero, drive is not available continue; } - + TInt err = iFs.Volume(volumeInfo, drive); TInt err_drive = iFs.Drive(driveInfo, drive); @@ -1295,7 +1314,7 @@ if( iFetchedChecker ) { - iFetchedChecker->SetFetchResult( aPath, KErrNone ); + iFetchedChecker->DeleteFetchResult( aPath ); } // need to create new thumbs @@ -1327,8 +1346,7 @@ if( iFetchedChecker ) { - iFetchedChecker->SetFetchResult( aNewPath, iFetchedChecker->LastFetchResult(aCurrentPath) ); - iFetchedChecker->SetFetchResult( aCurrentPath, KErrNone ); + iFetchedChecker->RenameFetchResultL( aNewPath, aCurrentPath ); } } @@ -1453,6 +1471,10 @@ { aMimeType = TDataType( KContactMime ); } + else if ( ext.CompareF( KAlbumArtExt ) == 0 ) + { + aMimeType = TDataType( KAlbumArtMime ); + } else { aMimeType = TDataType( KNullDesC8 ); @@ -1569,7 +1591,8 @@ mimeType.CompareF( KRealVideoMime ) == 0 || mimeType.CompareF( KFlashVideoMime ) == 0 || mimeType.CompareF( KMatroskaVideoMime ) == 0 || - mimeType.CompareF( KContactMime ) == 0 ) + mimeType.CompareF( KContactMime ) == 0 || + mimeType.CompareF( KAlbumArtMime ) == 0 ) { return ETrue; } @@ -1603,6 +1626,7 @@ "CThumbnailServer::E32Main() -- thread function out, result=%d", result ); delete cleanup; + cleanup = NULL; } if ( result != KErrNone ) {