Delphi / Object Pascal · Exception
What does Runtime Error 204: EInvalidPointer mean in Delphi / Object Pascal?
An operation on a pointer is invalid, most often a double free (calling Free twice on the same object) or freeing memory that was never validly allocated.
An operation on a pointer is invalid, most often a double free (calling Free twice on the same object) or freeing memory that was never validly allocated.
Set object references to nil immediately after freeing them, and consider FreeAndNil instead of a bare Free call so a second Free on the same variable becomes a harmless no-op instead of a crash.