summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2010-09-04 18:37:57 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2010-09-04 18:37:57 +0200
commit38220cdf935f3a2714bd837727d6ed73f4e9071c (patch)
treeb521a76005e293634d42a527e689464aa3b975cc
parentd21b3677c12861eea6bcbfe5b7e0d3f423160cd1 (diff)
downloadfpGUI-38220cdf935f3a2714bd837727d6ed73f4e9071c.tar.xz
fixed minor memory leak in File Dialog.
-rw-r--r--src/gui/fpg_dialogs.pas30
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);