diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2010-09-04 18:37:57 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2010-09-04 18:37:57 +0200 |
commit | 38220cdf935f3a2714bd837727d6ed73f4e9071c (patch) | |
tree | b521a76005e293634d42a527e689464aa3b975cc | |
parent | d21b3677c12861eea6bcbfe5b7e0d3f423160cd1 (diff) | |
download | fpGUI-38220cdf935f3a2714bd837727d6ed73f4e9071c.tar.xz |
fixed minor memory leak in File Dialog.
-rw-r--r-- | src/gui/fpg_dialogs.pas | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/gui/fpg_dialogs.pas b/src/gui/fpg_dialogs.pas index 9e98afbc..1db58f60 100644 --- a/src/gui/fpg_dialogs.pas +++ b/src/gui/fpg_dialogs.pas @@ -1303,17 +1303,15 @@ begin end; procedure TfpgFileDialog.btnBookmarkClicked(Sender: TObject); -var - pm: TfpgPopupMenu; begin - FBookmarkMenu.Free; + if Assigned(FBookmarkMenu) then + FBookmarkMenu.Free; FBookmarkMenu := CreatePopupMenu; FBookmarkMenu.ShowAt(self, btnBookmark.Left, btnBookmark.Bottom); end; procedure TfpgFileDialog.edFilenameChanged(Sender: TObject); begin - writeln('TfpgFileDialog.edFilenameChanged '); UpdateButtonState; end; @@ -1391,17 +1389,21 @@ begin with Result do begin lst := TStringList.Create; - if not Assigned(FIni) then - FIni := TfpgINIFile.CreateExt(fpgGetToolkitConfigDir + FPG_BOOKMARKS_FILE); - FIni.ReadSection(FPG_BOOKMARK_SECTION, lst); - // add previous bookmarks to menu - for i := 0 to lst.Count-1 do - begin - mi := AddMenuItem(lst[i], '', @BookmarkItemClicked); + try + if not Assigned(FIni) then + FIni := TfpgINIFile.CreateExt(fpgGetToolkitConfigDir + FPG_BOOKMARKS_FILE); + FIni.ReadSection(FPG_BOOKMARK_SECTION, lst); + // add previous bookmarks to menu + for i := 0 to lst.Count-1 do + begin + mi := AddMenuItem(lst[i], '', @BookmarkItemClicked); + end; + // Now add static items + if lst.Count > 0 then + AddMenuItem('-', '', nil); + finally + lst.Free; end; - // Now add static items - if lst.Count > 0 then - AddMenuItem('-', '', nil); mi := AddMenuItem('Add current directory', '', @BookmarkItemClicked); mi.Tag := 1; mi := AddMenuItem('Configure...', '', @BookmarkItemClicked); |