mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-05 04:20:19 +02:00
win32 interface: fixed memleak when showing an open file dialog
git-svn-id: trunk@11058 -
This commit is contained in:
parent
5c4e0e65c5
commit
bfe4a7f795
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user