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:
parent
3a8c63f5d4
commit
7ed282f314
1 changed files with 3 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue