win32 interface: fixed memleak when showing an open file dialog

git-svn-id: trunk@11058 -
This commit is contained in:
vincents 2007-05-03 07:01:52 +00:00
parent 5c4e0e65c5
commit bfe4a7f795

View File

@ -482,15 +482,16 @@ end;
class procedure TWin32WSSaveDialog.DestroyHandle(const ACommonDialog: TCommonDialog); class procedure TWin32WSSaveDialog.DestroyHandle(const ACommonDialog: TCommonDialog);
var var
OPENFILE: LPOPENFILENAME; OpenFile: LPOPENFILENAME;
begin begin
if ACommonDialog.Handle <> 0 then if ACommonDialog.Handle <> 0 then
begin begin
OPENFILE := LPOPENFILENAME(ACommonDialog.Handle); OpenFile := LPOPENFILENAME(ACommonDialog.Handle);
if OPENFILE^.lCustData <> 0 then if OpenFile^.lCustData <> 0 then
Dispose(POpenFileDialogRec(OPENFILE^.lCustData)); Dispose(POpenFileDialogRec(OPENFILE^.lCustData));
StrDispose(OpenFile^.lpStrFilter); StrDispose(OpenFile^.lpStrFilter);
FreeMem(OpenFile^.lpStrFile); FreeMem(OpenFile^.lpStrFile);
FreeMem(OpenFile);
end; end;
end; end;
@ -519,6 +520,7 @@ begin
Dispose(POpenFileDialogRec(OPENFILE^.lCustData)); Dispose(POpenFileDialogRec(OPENFILE^.lCustData));
StrDispose(OpenFile^.lpStrFilter); StrDispose(OpenFile^.lpStrFilter);
FreeMem(OpenFile^.lpStrFile); FreeMem(OpenFile^.lpStrFile);
FreeMem(OpenFile);
end; end;
end; end;