Fixed prevent issues
authorchitta ranjan <chitta.rs@samsung.com>
Tue, 9 Apr 2013 04:48:10 +0000 (13:48 +0900)
committerchitta ranjan <chitta.rs@samsung.com>
Tue, 9 Apr 2013 04:48:10 +0000 (13:48 +0900)
Change-Id: I608f5848b841c488ba52a7d4042bdca0ec684935
Signed-off-by: chitta ranjan <chitta.rs@samsung.com>
src/GlAlbumListPresentationModel.cpp
src/GlAllListEditorPanel.cpp
src/GlAllListSelectionPanel.cpp
src/GlCommonUtil.cpp
src/GlFileListPresentationModel.cpp
src/GlImageListEditorPanel.cpp
src/GlThumbnailProvider.cpp
src/GlVideoListEditorPanel.cpp

index 3e2c605..e726b52 100644 (file)
@@ -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))
index 9722435..f4d3afa 100644 (file)
@@ -329,6 +329,7 @@ AllListEditorPanel::CreateItem(int index)
                else
                {
                        AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
+                       delete pItemText;
                        return null;
                }
        }
index 35ec1f0..601af4a 100644 (file)
@@ -195,6 +195,7 @@ AllListSelectionPanel::CreateItem(int index)
                else
                {
                        AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
+                       delete pItemText;
                        return null;
                }
 
index 1a70c65..3cbd8de 100644 (file)
@@ -44,6 +44,7 @@ CommonUtil::GetEmptyThumbnailN(void)
        result r = pBitmap->Construct(mainRect);
        if (r != E_SUCCESS)
        {
+               delete pBitmap;
                return null;
        }
        BufferInfo bufferInfo;
index 8f93fe8..aa7d65e 100644 (file)
@@ -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;
 }
index 00e930d..c1ba3a2 100644 (file)
@@ -252,7 +252,8 @@ ImageListEditorPanel::CreateItem(int index)
                else
                {
                        AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
-
+                       delete pIconListviewItem;
+                       delete pItemText;
                        return null;
                }
        }
index 810553a..14a4083 100644 (file)
@@ -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<VideoContentInfo*>(pContentInfo);
-                       duration = pVideoContentInfo->GetDuration();
+                       if (contentType == CONTENT_TYPE_VIDEO)
+                       {
+                               VideoContentInfo* pVideoContentInfo = static_cast<VideoContentInfo*>(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()));
 
index 287e426..c34e8d7 100644 (file)
@@ -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;
                                }
                        }