From: Himanshu Date: Tue, 2 Jul 2013 05:34:35 +0000 (+0530) Subject: Fixed memory leaks X-Git-Tag: submit/tizen_2.2/20130714.134410~20 X-Git-Url: http://review.tizen.org/git/?p=apps%2Fosp%2FGallery.git;a=commitdiff_plain;h=37dbd66e3810eaa1396e4ce18a35add6a1400f08 Fixed memory leaks Change-Id: I5bbbdfa2584b9c8b77b6c24015befce9e9571f3a Signed-off-by: Himanshu --- diff --git a/src/GlAlbumListEditorForm.cpp b/src/GlAlbumListEditorForm.cpp index 25c0950..f11f62c 100644 --- a/src/GlAlbumListEditorForm.cpp +++ b/src/GlAlbumListEditorForm.cpp @@ -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"); diff --git a/src/GlAlbumListPresentationModel.cpp b/src/GlAlbumListPresentationModel.cpp index ebcca82..4f604a2 100644 --- a/src/GlAlbumListPresentationModel.cpp +++ b/src/GlAlbumListPresentationModel.cpp @@ -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; diff --git a/src/GlFileListEditorForm.cpp b/src/GlFileListEditorForm.cpp index 0d87e07..a50116b 100644 --- a/src/GlFileListEditorForm.cpp +++ b/src/GlFileListEditorForm.cpp @@ -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); diff --git a/src/GlFileListForm.cpp b/src/GlFileListForm.cpp index 4a9d3ac..52db43c 100644 --- a/src/GlFileListForm.cpp +++ b/src/GlFileListForm.cpp @@ -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) { diff --git a/src/GlFileListPresentationModel.cpp b/src/GlFileListPresentationModel.cpp index 5fde925..06a7e0e 100644 --- a/src/GlFileListPresentationModel.cpp +++ b/src/GlFileListPresentationModel.cpp @@ -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())