[fpc-devel] Suggestion: reference counted objects
DrDiettrich1 at aol.com
Sun Sep 21 07:22:51 CEST 2014
Boian Mitov schrieb:
> That is easy. it gets incremented when it gets assigned. The running
> threads have no way of accessing it if there is no reference
> (assignment) already in place.
The problem arises when an object is destroyed, or even elected for
destruction in _Release, while another thread starts using the same
> Indeed that is how it works in Delphi, and BTW: that is how Strings work
> in Delphi and FPC the last time I checked ;-) .
With strings it's possible to create another (unique) copy, when a
string is modified, and it does no harm when that copy is destroyed
later - every user will find an valid (empty) string. Not so with
objects, which cannot be copied nor reused after destruction.
More information about the fpc-devel