Fixed memory leaks
authorHimanshu <himanshu.t@samsung.com>
Tue, 2 Jul 2013 05:34:35 +0000 (11:04 +0530)
committerHimanshu <himanshu.t@samsung.com>
Tue, 2 Jul 2013 05:34:35 +0000 (11:04 +0530)
Change-Id: I5bbbdfa2584b9c8b77b6c24015befce9e9571f3a
Signed-off-by: Himanshu <himanshu.t@samsung.com>
src/GlAlbumListEditorForm.cpp
src/GlAlbumListPresentationModel.cpp
src/GlFileListEditorForm.cpp
src/GlFileListForm.cpp
src/GlFileListPresentationModel.cpp

index 25c0950..f11f62c 100644 (file)
@@ -345,8 +345,9 @@ AlbumListEditorForm::CreateItem(int index)
                if (pEditAlbumBitmap != NULL)
                {
                        pEditAlbumBitmap->Construct(*pEditAlbumCanvas, Rectangle(0, 0, canvasWidth, canvasHeight));
-                       delete pEditAlbumCanvas;
+
                }
+               delete pEditAlbumCanvas;
 
                albumName = pAlbumInfo->GetAlbumName();
                String reservedCameraName = ResourceManager::GetString(L"IDS_MEDIABR_BODY_CAMERA_ROLL_ABB");
index ebcca82..4f604a2 100644 (file)
@@ -674,6 +674,8 @@ AlbumListPresentationModel::InitializeAlbumInfoList(const ContentType& contentTy
 
                                        pAllAlbumInfo->AppendDirectory(*pDirPath);
                                        pAllAlbumInfo->AppendContentIdList(*pContentIdList);
+
+                                       pContentIdList->RemoveAll(true);
                                        delete pContentIdList;
                                }
                        }
@@ -688,6 +690,8 @@ AlbumListPresentationModel::InitializeAlbumInfoList(const ContentType& contentTy
 
                                        pAllAlbumInfo->AppendDirectory(*pDirPath);
                                        pAllAlbumInfo->AppendContentIdList(*pContentIdList);
+
+                                       pContentIdList->RemoveAll(true);
                                        delete pContentIdList;
                                }
                        }
@@ -709,9 +713,16 @@ AlbumListPresentationModel::InitializeAlbumInfoList(const ContentType& contentTy
 
                                                pAllAlbumInfo->AppendDirectory(*pDirPath);
                                                pAllAlbumInfo->AppendContentIdList(*pContentIdList);
+
+                                               pSubDirList->RemoveAll(true);
                                                delete pSubDirList;
                                        }
-                                       delete pContentIdList;
+
+                                       if ( pContentIdList != NULL)
+                                       {
+                                               pContentIdList->RemoveAll(true);
+                                               delete pContentIdList;
+                                       }
                                }
                                if (pAlbumInfo != null && pAlbumInfo->GetContentIdCount() > 0)
                                {
@@ -774,13 +785,18 @@ AlbumListPresentationModel::InitializeAlbumInfoList(const ContentType& contentTy
 
        if (pContentDirectoryPathList != null)
        {
+               pContentDirectoryPathList->RemoveAll(true);
                delete pContentDirectoryPathList;
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
        return;
 
 CATCH:
+if (pContentDirectoryPathList != null)
+{
+       pContentDirectoryPathList->RemoveAll(true);
        delete pContentDirectoryPathList;
+}
        delete pAllAlbumInfo;
        delete pCameraAlbumInfo;
        delete pDownloadAlbumInfo;
@@ -863,7 +879,13 @@ AlbumListPresentationModel::GetContentIdListInDirectoryN(const String& directory
                }
                delete pEnum;
        }
-       delete pContentInfoList;
+
+       if ( pContentInfoList != NULL)
+       {
+               pContentInfoList->RemoveAll(true);
+               delete pContentInfoList;
+       }
+
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
        return pContentIdList;
index 0d87e07..a50116b 100644 (file)
@@ -79,7 +79,15 @@ FileListEditorForm::~FileListEditorForm(void)
        AppLogDebug("ENTER");
        if (__pContentDirectoryList != null)
        {
+               __pContentDirectoryList->RemoveAll(true);
                delete __pContentDirectoryList;
+               __pContentDirectoryList = null;
+       }
+
+       if (__pPopUp != null)
+       {
+               delete __pPopUp;
+               __pPopUp = null;
        }
 
        if (__pContentDirectoryNameList != null)
@@ -927,6 +935,7 @@ FileListEditorForm::RefreshFolderList(void)
 
        if (__pContentDirectoryList != null)
        {
+               __pContentDirectoryList->RemoveAll(true);
                delete __pContentDirectoryList;
        }
        __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE);
index 4a9d3ac..52db43c 100644 (file)
@@ -51,6 +51,14 @@ FileListForm::FileListForm(void)
 FileListForm::~FileListForm(void)
 {
        AppLogDebug("ENTER");
+
+       if ( __pPopUp != NULL )
+       {
+               delete __pPopUp;
+               __pPopUp = NULL;
+       }
+
+
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -224,6 +232,7 @@ FileListForm::InitializeFooter(void)
        }
        pFooter->AddItem(itemCamera);
 
+       delete pBitmapCamera;
 
        if (__pOptionMenu != null)
        {
index 5fde925..06a7e0e 100644 (file)
@@ -131,7 +131,9 @@ FileListPresentationModel::Construct(void)
 
        if (__pIconListViewCache != null)
        {
+               __pIconListViewCache->RemoveAll(true);
                delete __pIconListViewCache;
+               __pIconListViewCache = null;
        }
        __pIconListViewCache = new (std::nothrow) ArrayList(SingleObjectDeleter);
        __pIconListViewCache->Construct(SIZE_ICON_LIST_CACHE);
@@ -230,6 +232,7 @@ FileListPresentationModel::DestroyInstance(void)
 
        if (__pIconListViewCache != null)
        {
+               __pIconListViewCache->RemoveAll(true);
                delete __pIconListViewCache;
                __pIconListViewCache = null;
        }
@@ -609,6 +612,8 @@ FileListPresentationModel::OnThumbnailReceivedN(IEventArg& eventArg)
                                }
                        }
 
+                       delete pEnum;
+
                        if (isMatch == false)
                        {
                                if (SIZE_ICON_LIST_CACHE <= __pIconListViewCache->GetCount())