Browse Source

Added a method OptionalScopedPointer::reset()

tags/2021-05-28
jules 7 years ago
parent
commit
faa847f443
2 changed files with 8 additions and 5 deletions
  1. +7
    -4
      modules/juce_core/memory/juce_OptionalScopedPointer.h
  2. +1
    -1
      modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp

+ 7
- 4
modules/juce_core/memory/juce_OptionalScopedPointer.h 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;
}


+ 1
- 1
modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp View File

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


Loading…
Cancel
Save