From: chitta ranjan Date: Tue, 9 Apr 2013 04:48:10 +0000 (+0900) Subject: Fixed prevent issues X-Git-Tag: accepted/tizen_2.1/20130425.023637~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a683c65682bd87cd65db07fa695fe46c24b5c09;p=apps%2Fosp%2FGallery.git Fixed prevent issues Change-Id: I608f5848b841c488ba52a7d4042bdca0ec684935 Signed-off-by: chitta ranjan --- diff --git a/src/GlAlbumListPresentationModel.cpp b/src/GlAlbumListPresentationModel.cpp index 3e2c605..e726b52 100644 --- a/src/GlAlbumListPresentationModel.cpp +++ b/src/GlAlbumListPresentationModel.cpp @@ -936,9 +936,16 @@ IList* AlbumListPresentationModel::GetContentIdListAtIndexN(const IList& indexLi pListT->Add(CONTENT_TYPE_IMAGE); pListT->Add(CONTENT_TYPE_VIDEO); - directory.Construct(*pListT); + result r = directory.Construct(*pListT); delete pListT; + if (r != E_SUCCESS) + { + AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult())); + delete pContentIdList; + return null; + } + IList* pContentDirectoryPathList = directory.GetContentDirectoryPathListN(SORT_ORDER_ASCENDING); String* pDirPath = null; if ((pContentDirectoryPathList != null) && (pContentDirectoryPathList->GetCount() > 0)) diff --git a/src/GlAllListEditorPanel.cpp b/src/GlAllListEditorPanel.cpp index 9722435..f4d3afa 100644 --- a/src/GlAllListEditorPanel.cpp +++ b/src/GlAllListEditorPanel.cpp @@ -329,6 +329,7 @@ AllListEditorPanel::CreateItem(int index) else { AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + delete pItemText; return null; } } diff --git a/src/GlAllListSelectionPanel.cpp b/src/GlAllListSelectionPanel.cpp index 35ec1f0..601af4a 100644 --- a/src/GlAllListSelectionPanel.cpp +++ b/src/GlAllListSelectionPanel.cpp @@ -195,6 +195,7 @@ AllListSelectionPanel::CreateItem(int index) else { AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); + delete pItemText; return null; } diff --git a/src/GlCommonUtil.cpp b/src/GlCommonUtil.cpp index 1a70c65..3cbd8de 100644 --- a/src/GlCommonUtil.cpp +++ b/src/GlCommonUtil.cpp @@ -44,6 +44,7 @@ CommonUtil::GetEmptyThumbnailN(void) result r = pBitmap->Construct(mainRect); if (r != E_SUCCESS) { + delete pBitmap; return null; } BufferInfo bufferInfo; diff --git a/src/GlFileListPresentationModel.cpp b/src/GlFileListPresentationModel.cpp index 8f93fe8..aa7d65e 100644 --- a/src/GlFileListPresentationModel.cpp +++ b/src/GlFileListPresentationModel.cpp @@ -1590,43 +1590,38 @@ result FileListPresentationModel::RotateImage(int index, RotateMode rotateMode) { result r = E_SUCCESS; + ImageBuffer rotateBuffer; ImageBuffer* pRotatedBuffer = null; - ImageBuffer* pRotatedBuffer1 = null; ImageFormat imageFormat; - int width = 0; - int height = 0; - pRotatedBuffer = new (std::nothrow) ImageBuffer(); - + Image img; String filePath = GetContentFilePath(index); - r = pRotatedBuffer->Construct(filePath); - ImageBuffer::GetImageInfo(filePath, imageFormat, width, height); + r = img.Construct(); + if (r == E_SUCCESS) { + imageFormat = img.GetImageFormat(filePath); + } + + r = rotateBuffer.Construct(filePath); + if (r == E_SUCCESS) + { if (rotateMode == ROTATE_MODE_RIGHT) { - pRotatedBuffer1 = pRotatedBuffer->RotateN(IMAGE_ROTATION_90); + pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_90); } else { - pRotatedBuffer1 = pRotatedBuffer->RotateN(IMAGE_ROTATION_270); + pRotatedBuffer = rotateBuffer.RotateN(IMAGE_ROTATION_270); } } - TryCatch(pRotatedBuffer1 != null, r = GetLastResult(), "RotateN failed:%s", GetErrorMessage(GetLastResult())); - pRotatedBuffer1->EncodeToFile(filePath, imageFormat, true, 100); - ContentManager::ScanFile(filePath); - delete pRotatedBuffer1; - delete pRotatedBuffer; - return r; - CATCH: - if (pRotatedBuffer != null) //this buffer is no longer used + if (pRotatedBuffer != null) { + r = pRotatedBuffer->EncodeToFile(filePath, imageFormat, true, 100); delete pRotatedBuffer; } - if (pRotatedBuffer1 != null) //this buffer is no longer used - { - delete pRotatedBuffer1; - } + + ContentManager::ScanFile(filePath); return r; } diff --git a/src/GlImageListEditorPanel.cpp b/src/GlImageListEditorPanel.cpp index 00e930d..c1ba3a2 100644 --- a/src/GlImageListEditorPanel.cpp +++ b/src/GlImageListEditorPanel.cpp @@ -252,7 +252,8 @@ ImageListEditorPanel::CreateItem(int index) else { AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); - + delete pIconListviewItem; + delete pItemText; return null; } } diff --git a/src/GlThumbnailProvider.cpp b/src/GlThumbnailProvider.cpp index 810553a..14a4083 100644 --- a/src/GlThumbnailProvider.cpp +++ b/src/GlThumbnailProvider.cpp @@ -369,24 +369,19 @@ ThumbnailProvider::GetThumbnailInfoN(const ContentId& contentId) const } } pBitmap->Scale(DIMENSION_DEFAULT_THUMBNAIL); - } - else - { - delete pContentInfo; - AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult())); - return null; - } + ContentType contentType = pContentInfo->GetContentType(); - ContentType contentType = pContentInfo->GetContentType(); - if (contentType == CONTENT_TYPE_VIDEO) - { - VideoContentInfo* pVideoContentInfo = static_cast(pContentInfo); - duration = pVideoContentInfo->GetDuration(); + if (contentType == CONTENT_TYPE_VIDEO) + { + VideoContentInfo* pVideoContentInfo = static_cast(pContentInfo); + duration = pVideoContentInfo->GetDuration(); + } + + pNewThumbnailInfo = new (std::nothrow) ThumbnailInfo(); + pNewThumbnailInfo->Construct(contentId, pContentInfo->GetContentPath(), *pBitmap, contentType, duration); + delete pBitmap; } - pNewThumbnailInfo = new (std::nothrow) ThumbnailInfo(); - pNewThumbnailInfo->Construct(contentId, pContentInfo->GetContentPath(), *pBitmap, contentType, duration); - delete pBitmap; } AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult())); diff --git a/src/GlVideoListEditorPanel.cpp b/src/GlVideoListEditorPanel.cpp index 287e426..c34e8d7 100644 --- a/src/GlVideoListEditorPanel.cpp +++ b/src/GlVideoListEditorPanel.cpp @@ -258,7 +258,9 @@ VideoListEditorPanel::CreateItem(int index, int itemWidth) else { AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult())); - + delete pTitle; + delete pItemText; + delete pDuration; return null; } }