🚨 Stop the range selection helper from leaking
Abandoning a selection after the first click leaked the helper and kept it registered for tile clicks. The helper now tracks the active instance, copies coordinates instead of holding tile references that can be evicted, and the listener dispatch tolerates removal during iteration.
This commit is contained in:
+3
-3
@@ -729,7 +729,7 @@ var
|
||||
tileX, tileY, newX, newY: Word;
|
||||
targetBlocks: TBlockInfoList;
|
||||
targetTile: TWorldItem;
|
||||
selectionListener: TSelectionListener;
|
||||
listenerIndex: Integer;
|
||||
begin
|
||||
Logger.EnterMethod([lcClient, lcDebug], 'MouseUp');
|
||||
if Button <> mbLeft then
|
||||
@@ -757,9 +757,9 @@ begin
|
||||
mnuGrabTileIDClick(nil);
|
||||
end;
|
||||
|
||||
for selectionListener in FSelectionListeners do
|
||||
for listenerIndex := FSelectionListeners.Count - 1 downto 0 do
|
||||
begin
|
||||
selectionListener(CurrentTile);
|
||||
FSelectionListeners[listenerIndex](CurrentTile);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user