ADD: Patch "Hotkey manager leak fix" [3398827].

This commit is contained in:
cobines 2011-08-27 01:53:14 +00:00
commit fec2fc137d
3 changed files with 27 additions and 1 deletions

View file

@ -1057,6 +1057,12 @@ var
begin
DCDebug('Destroying main form');
if Assigned(HotMan) then
begin
HotMan.UnRegister(edtCommand);
HotMan.UnRegister(Self);
end;
TDriveWatcher.RemoveObserver(@OnDriveWatcherEvent);
TDriveWatcher.Finalize;
DCDebug('Drive watcher finished');

View file

@ -2796,6 +2796,13 @@ end;
destructor TColumnsFileView.Destroy;
begin
if Assigned(HotMan) then
begin
HotMan.UnRegister(edtFilter);
HotMan.UnRegister(edtSearch);
HotMan.UnRegister(dgPanel);
end;
FreeThenNil(FSavedSelection);
FreeThenNil(FColumnsSorting);
inherited Destroy;

View file

@ -430,7 +430,7 @@ constructor THMBaseObject.Create(AName: String);
begin
FName := AName;
FHotkeys := THotkeys.Create(True);
FObjects := TFPObjectList.Create(False);
FObjects := TFPObjectList.Create(True);
end;
destructor THMBaseObject.Destroy;
@ -919,6 +919,7 @@ var
ParentForm: TCustomForm;
form: THMForm;
control: THMControl;
i: Integer;
begin
ParentForm := GetParentForm(AControl);
if Assigned(ParentForm) then
@ -926,6 +927,18 @@ begin
form := FForms.Find(ParentForm);
if Assigned(form) then
begin
control := form.Controls.Find(AControl);
if Assigned(control) then
control.Delete(AControl);
end;
end
else
begin
// control lost its parent, find through all forms
for i := 0 to FForms.Count - 1 do
begin
form := FForms[i];
control := form.Controls.Find(AControl);
if Assigned(control) then
control.Delete(AControl);