Bug in Ldocktree.pas (and a patch)
* Lazarus/FPC Version: Lazarus 4.0 (rev lazarus_4_0) FPC 3.2.2 x86_64-win64-win32/win64 * Operating System: Windows 11 * CPU / Bitness: 64 Bit ## What happens Access Violation when you use Ldocktree.pas and set docksite:= true for a panel and then click on it. It seems that there is a small bug in Ldocktree.pas. If you add Ldocktree to uses and then place a panel on a form and set docksite = true for this pabel, you will get an Access violation error if you click on the panel with the mouse. The cause is in the function: procedure TDockHeader.PerformMouseDown(AControl: TControl; It does not check whether aControl is nil. Solution: if AControl = nil then Exit; // <----- new line added. Then the AV is gone. ```pascal class procedure TDockHeader.PerformMouseDown(AControl: TControl; APart: TLazDockHeaderPart); begin if AControl = nil then Exit; // <----- new line added. Then the AV is gone. case APart of ldhpAll, ldhpCaption: // mouse down on not buttons => start drag AControl.BeginDrag(False); end; end; ` ``` See also: https://forum.lazarus.freepascal.org/index.php/topic,71229.msg555689.html#msg555689
issue