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

Added a method OptionalScopedPointer::reset()

This commit is contained in:
jules 2017-12-13 11:05:22 +00:00
parent 202cad8991
commit faa847f443
2 changed files with 8 additions and 5 deletions

View file

@ -79,7 +79,7 @@ public:
{
if (object != objectToTransferFrom.object)
{
clear();
reset();
object = objectToTransferFrom.object;
}
@ -93,7 +93,7 @@ public:
*/
~OptionalScopedPointer()
{
clear();
reset();
}
//==============================================================================
@ -118,12 +118,15 @@ public:
/** Resets this pointer to null, possibly deleting the object that it holds, if it has
ownership of it.
*/
void clear()
void reset()
{
if (! shouldDelete)
object.release();
}
/** Does the same thing as reset(). */
void clear() { reset(); }
/** Makes this OptionalScopedPointer point at a new object, specifying whether the
OptionalScopedPointer will take ownership of the object.
@ -135,7 +138,7 @@ public:
{
if (object != newObject)
{
clear();
reset();
object = newObject;
}

View file

@ -110,7 +110,7 @@ public:
if (subContentsList != nullptr)
{
subContentsList->removeChangeListener (this);
subContentsList.clear();
subContentsList.reset();
}
}