IDictionary.RemoveAll receives invalid parameter

Issue #408 duplicate
Primož Gabrijelčič created an issue

In the attached program, the ‘item’ parameter in the anonymous function passed to the RemoveAll call is invalid and accessing item’s fields will most probably crash the program.

Clients.RemoveAll(
  function (const item: TPair<TClient, int64>): boolean
  begin
    // item is invalid here and next line will probably crash the program
    Writeln(item.Key.Key);
    Result := false;
  end);

Tested on develop HEAD as of 2024-02-23 (8712d703bd67392d48fdfb61b3a17cdfb980cbc3).

Comments (1)

  1. Log in to comment