1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-23 01:44:22 +00:00

Fix for obscure order-of-deletion problems involving self-referenctial ReferenceCountedObjectPtrs

This commit is contained in:
jules 2018-07-05 16:46:11 +01:00
parent 3a8c63f5d4
commit 7ed282f314

View file

@ -378,8 +378,9 @@ public:
/** Resets this object to a null pointer. */
void reset() noexcept
{
decIfNotNull (referencedObject);
referencedObject = nullptr;
auto oldObject = referencedObject; // need to null the pointer before deleting the object
referencedObject = nullptr; // in case this ptr is itself deleted as a side-effect
decIfNotNull (oldObject); // of the destructor
}
// the -> operator is called on the referenced object