Skip to content

Commit 627cd0f

Browse files
joachim.marderValtsS
joachim.marder
authored andcommitted
Fixed issue JAM-Software#285 (access violation when mouse down over checkbox sometimes)
1 parent 3e54cec commit 627cd0f

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Source/VirtualTrees.pas

+12-6
Original file line numberDiff line numberDiff line change
@@ -23610,12 +23610,18 @@ procedure TBaseVirtualTree.HandleMouseUp(var Message: TWMMouse; const HitInfo: T
2361023610
if tsMouseCheckPending in FStates then
2361123611
begin
2361223612
DoStateChange([], [tsMouseCheckPending]);
23613-
// Is the mouse still over the same node?
23614-
if (HitInfo.HitNode = FCheckNode) and (hiOnItem in HitInfo.HitPositions) then
23615-
DoCheckClick(FCheckNode, FPendingCheckState)
23616-
else
23617-
FCheckNode.CheckState := UnpressedState[FCheckNode.CheckState];
23618-
InvalidateNode(FCheckNode);
23613+
// Need check for nil, issue #285
23614+
// because when mouse down on checkbox but not yet released
23615+
// and in this time list starts to rebuild by timer
23616+
// after this when mouse release FCheckNode equal nil
23617+
if Assigned (FCheckNode) then begin
23618+
// Is the mouse still over the same node?
23619+
if (HitInfo.HitNode = FCheckNode) and (hiOnItem in HitInfo.HitPositions) then
23620+
DoCheckClick(FCheckNode, FPendingCheckState)
23621+
else
23622+
FCheckNode.CheckState := UnpressedState[FCheckNode.CheckState];
23623+
InvalidateNode(FCheckNode);
23624+
end;
2361923625
FCheckNode := nil;
2362023626
end;
2362123627

0 commit comments

Comments
 (0)