RCArray is unsafe
Zach the Mystic via Digitalmars-d
digitalmars-d at puremagic.com
Mon Mar 2 16:05:49 PST 2015
On Monday, 2 March 2015 at 22:58:19 UTC, Walter Bright wrote:
> His insight was that the deletion of the payload occurred
> before the end of the lifetime of the RC object, and that this
> was the source of the problem. If the deletion of the payload
> occurs during the destructor call, rather than the postblit,
> then although the ref count of the payload goes to zero, it
> doesn't actually get deleted.
>
> I.e. the postblit manipulates the ref count, but does NOT do
> payload deletions. The destructor checks the ref count, if it
> is zero, THEN it does the payload deletion.
I guess you also mean opAssigns -- they would manipulate
refcounts too right? In fact, they would be the primary means of
decrementing the refcount *apart* from the destructor, right?
More information about the Digitalmars-d
mailing list