diff --git a/lcl/controls.pp b/lcl/controls.pp index 1543e2207c..7eec2e3e36 100644 --- a/lcl/controls.pp +++ b/lcl/controls.pp @@ -343,6 +343,7 @@ type FControl: TControl; FDragTarget: TControl; FDragTargetPos: TPoint; + FAutoFree: Boolean; FAutoCreated: Boolean; FDropped: Boolean; protected @@ -358,6 +359,7 @@ type property AlwaysShowDragImages: Boolean read FAlwaysShowDragImages write FAlwaysShowDragImages; property AutoCreated: Boolean read FAutoCreated; + property AutoFree: Boolean read FAutoFree; property Control: TControl read FControl write FControl; property DragPos: TPoint read FDragPos write FDragPos; property DragTarget: TControl read FDragTarget write FDragTarget; diff --git a/lcl/include/dragmanager.inc b/lcl/include/dragmanager.inc index c14c0e254f..639737c1dd 100644 --- a/lcl/include/dragmanager.inc +++ b/lcl/include/dragmanager.inc @@ -253,7 +253,7 @@ begin finally //erase global variables (dragging stopped) - if ADragObjectCopy.AutoCreated then + if ADragObjectCopy.AutoFree then ADragObjectCopy.Free; end; end; @@ -532,7 +532,7 @@ begin ADockObjectCopy.Control.DragCanceled; ADockObjectCopy.EndDrag(ADockObjectCopy.DragTarget,TargetPos.X,TargetPos.Y); finally - if ADockObjectCopy.AutoCreated then + if ADockObjectCopy.AutoFree then ADockObjectCopy.Free end; end; diff --git a/lcl/include/dragobject.inc b/lcl/include/dragobject.inc index 69ca07d42e..d23466afc8 100644 --- a/lcl/include/dragobject.inc +++ b/lcl/include/dragobject.inc @@ -29,6 +29,7 @@ constructor TDragObject.AutoCreate(AControl: TControl); begin Create(AControl); FAutoCreated := True; + FAutoFree := True; end; procedure TDragObject.EndDrag(Target: TObject; X, Y: Integer); @@ -67,7 +68,7 @@ end; constructor TDragObjectEx.Create(AControl: TControl); begin inherited Create(AControl); - FAutoCreated := True; + FAutoFree := True; end; { TDragControlObject } @@ -90,7 +91,7 @@ end; constructor TDragControlObjectEx.Create(AControl: TControl); begin inherited Create(AControl); - FAutoCreated := True; + FAutoFree := True; end; { TDragDockObject } @@ -160,7 +161,7 @@ end; constructor TDragDockObjectEx.Create(AControl: TControl); begin inherited Create(AControl); - FAutoCreated := True; + FAutoFree := True; end; // included by controls.pp