summaryrefslogtreecommitdiff
path: root/src/corelib/gdi
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-10-29 15:03:11 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-10-29 15:03:11 +0200
commit1be6b8dc3417de2b7b8c9c32e92755ece9d6498c (patch)
treedfa21d3f8e0870bcf025f01fc0810c58cc91ad54 /src/corelib/gdi
parent6b581c77c401905e5bf72ed6aa133f0e046126a2 (diff)
downloadfpGUI-1be6b8dc3417de2b7b8c9c32e92755ece9d6498c.tar.xz
Fixed Windows DND memory leaks.
Diffstat (limited to 'src/corelib/gdi')
-rw-r--r--src/corelib/gdi/fpg_gdi.pas30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas
index e4cea8a5..e85d81e3 100644
--- a/src/corelib/gdi/fpg_gdi.pas
+++ b/src/corelib/gdi/fpg_gdi.pas
@@ -1257,6 +1257,8 @@ end;
destructor TfpgGDIApplication.Destroy;
begin
+ if Assigned(FDrag) then
+ FDrag.Free;
UnhookWindowsHookEx(ActivationHook);
inherited Destroy;
end;
@@ -1389,17 +1391,19 @@ begin
{ enumerate the available formats and return them as a StringList }
lMimeList := EnumDataToStringList(DataObj);
-
- if lMimeList.Count > 0 then
- lMimeChoice := lMimeList[0]
- else
- {$NOTE We need to replace this message with a resouce string }
- raise Exception.Create('fpGUI/GDI: no mime types available for DND operation');
-
- lDropAction := TranslateToFPGDropAction(Effect);
- if Assigned(wg.OnDragEnter) then
- wg.OnDragEnter(self, nil, lMimeList, lMimeChoice, lDropAction, lAccept);
-
+ try
+ if lMimeList.Count > 0 then
+ lMimeChoice := lMimeList[0]
+ else
+ {$NOTE We need to replace this message with a resouce string }
+ raise Exception.Create('fpGUI/GDI: no mime types available for DND operation');
+
+ lDropAction := TranslateToFPGDropAction(Effect);
+ if Assigned(wg.OnDragEnter) then
+ wg.OnDragEnter(self, nil, lMimeList, lMimeChoice, lDropAction, lAccept);
+ finally
+ lMimeList.Free;
+ end;
if not lAccept then
Effect := DROPEFFECT_NONE
else
@@ -1915,6 +1919,8 @@ begin
OnStartDragDetected is complete. So we need to set FDragActive to False
here. }
FDragActive := False;
+ if Assigned(wapplication.FDrag) then
+ FreeAndNil(wapplication.FDrag);
end;
constructor TfpgGDIWindow.Create(AOwner: TComponent);
@@ -1931,7 +1937,7 @@ end;
destructor TfpgGDIWindow.Destroy;
begin
- if (self as TfpgWidget).AcceptDrops and Assigned(FDropManager) then
+ if Assigned(FDropManager) then
FDropManager.Free;
inherited Destroy;
end;