TPointer/TAPointer copy and assignment is unsafe
Borland's Object Windows Library for the modern age
Brought to you by:
jogybl,
sebas_ledesma
Also: TPointer and TAPointer do not test for self-assigment, leading to an invalid pointer and double delete and crash on destruction, if not prevented manually.
I think that it doesn't make much sense of creating a copy of a TPointer/TAPointer object. They are simple classes with one purpose - to hold a pointer to some memory allocated in a block and release the memory when going out of scope.
So, we can make a private copy constructor and assignment operators to prevent accidental copying and make the TPointer(T* pointer) constructor explicit to prevent casts from other TPointers
About the TPointer<t>& operator =
It is a good idea to check for self-assignment.</t>
Fixed in [r1163].
Related
Commit: [r1163]
Last edit: Vidar Hasfjord 2015-05-11
Regression in [r1163] fixed in [r1317].
BUG: Syntax error in check for self-assignment in TEnvelope::operator= and TAEnvelope::operator=.
Related
Commit: [r1163]
Commit: [r1317]
Last edit: Vidar Hasfjord 2015-05-11