mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
Removed the ComponentDeletionWatcher class - use Component::SafePointer or Component::BailOutChecker instead.
This commit is contained in:
parent
28518aa834
commit
1e1e4ae848
8 changed files with 2 additions and 166 deletions
|
|
@ -114,7 +114,6 @@
|
|||
84816EA410809DCB008FEC33 /* juce_Component.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F1EA4710403708006A1807 /* juce_Component.h */; };
|
||||
84816EA510809DCB008FEC33 /* juce_ComponentAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F1EAA510403709006A1807 /* juce_ComponentAnimator.h */; };
|
||||
84816EA610809DCB008FEC33 /* juce_ComponentBoundsConstrainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F1EAA710403709006A1807 /* juce_ComponentBoundsConstrainer.h */; };
|
||||
84816EA710809DCB008FEC33 /* juce_ComponentDeletionWatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F1EA4810403708006A1807 /* juce_ComponentDeletionWatcher.h */; };
|
||||
84816EA810809DCB008FEC33 /* juce_ComponentDragger.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F1EACF10403709006A1807 /* juce_ComponentDragger.h */; };
|
||||
84816EA910809DCB008FEC33 /* juce_ComponentListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F1EA4A10403708006A1807 /* juce_ComponentListener.h */; };
|
||||
84816EAA10809DCB008FEC33 /* juce_ComponentMovementWatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F1EAA910403709006A1807 /* juce_ComponentMovementWatcher.h */; };
|
||||
|
|
@ -958,7 +957,6 @@
|
|||
84F1EA43104036D6006A1807 /* juce_WaitableEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F1E9E9104036D6006A1807 /* juce_WaitableEvent.h */; };
|
||||
84F1EBCC1040370A006A1807 /* juce_Component.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F1EA4610403708006A1807 /* juce_Component.cpp */; };
|
||||
84F1EBCD1040370A006A1807 /* juce_Component.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F1EA4710403708006A1807 /* juce_Component.h */; };
|
||||
84F1EBCE1040370A006A1807 /* juce_ComponentDeletionWatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F1EA4810403708006A1807 /* juce_ComponentDeletionWatcher.h */; };
|
||||
84F1EBCF1040370A006A1807 /* juce_ComponentListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F1EA4910403708006A1807 /* juce_ComponentListener.cpp */; };
|
||||
84F1EBD01040370A006A1807 /* juce_ComponentListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F1EA4A10403708006A1807 /* juce_ComponentListener.h */; };
|
||||
84F1EBD11040370A006A1807 /* juce_Desktop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F1EA4B10403708006A1807 /* juce_Desktop.cpp */; };
|
||||
|
|
@ -1578,7 +1576,6 @@
|
|||
84F1E9E9104036D6006A1807 /* juce_WaitableEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = juce_WaitableEvent.h; path = ../../src/threads/juce_WaitableEvent.h; sourceTree = SOURCE_ROOT; };
|
||||
84F1EA4610403708006A1807 /* juce_Component.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = juce_Component.cpp; path = ../../src/gui/components/juce_Component.cpp; sourceTree = SOURCE_ROOT; };
|
||||
84F1EA4710403708006A1807 /* juce_Component.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = juce_Component.h; path = ../../src/gui/components/juce_Component.h; sourceTree = SOURCE_ROOT; };
|
||||
84F1EA4810403708006A1807 /* juce_ComponentDeletionWatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = juce_ComponentDeletionWatcher.h; path = ../../src/gui/components/juce_ComponentDeletionWatcher.h; sourceTree = SOURCE_ROOT; };
|
||||
84F1EA4910403708006A1807 /* juce_ComponentListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = juce_ComponentListener.cpp; path = ../../src/gui/components/juce_ComponentListener.cpp; sourceTree = SOURCE_ROOT; };
|
||||
84F1EA4A10403708006A1807 /* juce_ComponentListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = juce_ComponentListener.h; path = ../../src/gui/components/juce_ComponentListener.h; sourceTree = SOURCE_ROOT; };
|
||||
84F1EA4B10403708006A1807 /* juce_Desktop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = juce_Desktop.cpp; path = ../../src/gui/components/juce_Desktop.cpp; sourceTree = SOURCE_ROOT; };
|
||||
|
|
@ -2467,7 +2464,6 @@
|
|||
children = (
|
||||
84F1EA4610403708006A1807 /* juce_Component.cpp */,
|
||||
84F1EA4710403708006A1807 /* juce_Component.h */,
|
||||
84F1EA4810403708006A1807 /* juce_ComponentDeletionWatcher.h */,
|
||||
84F1EA4910403708006A1807 /* juce_ComponentListener.cpp */,
|
||||
84F1EA4A10403708006A1807 /* juce_ComponentListener.h */,
|
||||
84F1EA4B10403708006A1807 /* juce_Desktop.cpp */,
|
||||
|
|
@ -3011,7 +3007,6 @@
|
|||
84816EA410809DCB008FEC33 /* juce_Component.h in Headers */,
|
||||
84816EA510809DCB008FEC33 /* juce_ComponentAnimator.h in Headers */,
|
||||
84816EA610809DCB008FEC33 /* juce_ComponentBoundsConstrainer.h in Headers */,
|
||||
84816EA710809DCB008FEC33 /* juce_ComponentDeletionWatcher.h in Headers */,
|
||||
84816EA810809DCB008FEC33 /* juce_ComponentDragger.h in Headers */,
|
||||
84816EA910809DCB008FEC33 /* juce_ComponentListener.h in Headers */,
|
||||
84816EAA10809DCB008FEC33 /* juce_ComponentMovementWatcher.h in Headers */,
|
||||
|
|
@ -3434,7 +3429,6 @@
|
|||
84F1EA42104036D6006A1807 /* juce_TimeSliceThread.h in Headers */,
|
||||
84F1EA43104036D6006A1807 /* juce_WaitableEvent.h in Headers */,
|
||||
84F1EBCD1040370A006A1807 /* juce_Component.h in Headers */,
|
||||
84F1EBCE1040370A006A1807 /* juce_ComponentDeletionWatcher.h in Headers */,
|
||||
84F1EBD01040370A006A1807 /* juce_ComponentListener.h in Headers */,
|
||||
84F1EBD21040370A006A1807 /* juce_Desktop.h in Headers */,
|
||||
84F1EBD41040370A006A1807 /* juce_ArrowButton.h in Headers */,
|
||||
|
|
|
|||
|
|
@ -1344,10 +1344,6 @@
|
|||
RelativePath="..\..\..\src\gui\components\juce_Component.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\gui\components\juce_ComponentDeletionWatcher.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\gui\components\juce_ComponentListener.cpp"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -41593,27 +41593,6 @@ bool Component::BailOutChecker::shouldBailOut() const throw()
|
|||
return safePointer1 == 0 || safePointer2 != component2;
|
||||
}
|
||||
|
||||
ComponentDeletionWatcher::ComponentDeletionWatcher (const Component* const componentToWatch_) throw()
|
||||
: componentToWatch (componentToWatch_),
|
||||
componentUID (componentToWatch_->getComponentUID())
|
||||
{
|
||||
// not possible to check on an already-deleted object..
|
||||
jassert (componentToWatch_->isValidComponent());
|
||||
}
|
||||
|
||||
ComponentDeletionWatcher::~ComponentDeletionWatcher() throw() {}
|
||||
|
||||
bool ComponentDeletionWatcher::hasBeenDeleted() const throw()
|
||||
{
|
||||
return ! (componentToWatch->isValidComponent()
|
||||
&& componentToWatch->getComponentUID() == componentUID);
|
||||
}
|
||||
|
||||
const Component* ComponentDeletionWatcher::getComponent() const throw()
|
||||
{
|
||||
return hasBeenDeleted() ? 0 : componentToWatch;
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
/*** End of inlined file: juce_Component.cpp ***/
|
||||
|
||||
|
|
|
|||
|
|
@ -12568,7 +12568,7 @@ public:
|
|||
uint32 getComponentUID() const throw() { return componentUID; }
|
||||
|
||||
template <class ComponentType>
|
||||
class JUCE_API SafePointer : private ComponentListener
|
||||
class SafePointer : private ComponentListener
|
||||
{
|
||||
public:
|
||||
SafePointer() : comp (0) {}
|
||||
|
|
@ -23466,39 +23466,6 @@ private:
|
|||
#endif
|
||||
#ifndef __JUCE_COMPONENT_JUCEHEADER__
|
||||
|
||||
#endif
|
||||
#ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
|
||||
|
||||
/*** Start of inlined file: juce_ComponentDeletionWatcher.h ***/
|
||||
#ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
|
||||
#define __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
|
||||
|
||||
class JUCE_API ComponentDeletionWatcher
|
||||
{
|
||||
public:
|
||||
|
||||
ComponentDeletionWatcher (const Component* const componentToWatch) throw();
|
||||
|
||||
~ComponentDeletionWatcher() throw();
|
||||
|
||||
bool hasBeenDeleted() const throw();
|
||||
|
||||
const Component* getComponent() const throw();
|
||||
|
||||
juce_UseDebuggingNewOperator
|
||||
|
||||
private:
|
||||
const Component* const componentToWatch;
|
||||
const uint32 componentUID;
|
||||
|
||||
ComponentDeletionWatcher (const ComponentDeletionWatcher&);
|
||||
ComponentDeletionWatcher& operator= (const ComponentDeletionWatcher&);
|
||||
};
|
||||
|
||||
#endif // __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
|
||||
/*** End of inlined file: juce_ComponentDeletionWatcher.h ***/
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
#include "juce_Component.h"
|
||||
#include "juce_ComponentDeletionWatcher.h"
|
||||
#include "juce_Desktop.h"
|
||||
#include "windows/juce_ComponentPeer.h"
|
||||
#include "keyboard/juce_KeyListener.h"
|
||||
|
|
@ -3197,27 +3196,5 @@ bool Component::BailOutChecker::shouldBailOut() const throw()
|
|||
return safePointer1 == 0 || safePointer2 != component2;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
ComponentDeletionWatcher::ComponentDeletionWatcher (const Component* const componentToWatch_) throw()
|
||||
: componentToWatch (componentToWatch_),
|
||||
componentUID (componentToWatch_->getComponentUID())
|
||||
{
|
||||
// not possible to check on an already-deleted object..
|
||||
jassert (componentToWatch_->isValidComponent());
|
||||
}
|
||||
|
||||
ComponentDeletionWatcher::~ComponentDeletionWatcher() throw() {}
|
||||
|
||||
bool ComponentDeletionWatcher::hasBeenDeleted() const throw()
|
||||
{
|
||||
return ! (componentToWatch->isValidComponent()
|
||||
&& componentToWatch->getComponentUID() == componentUID);
|
||||
}
|
||||
|
||||
const Component* ComponentDeletionWatcher::getComponent() const throw()
|
||||
{
|
||||
return hasBeenDeleted() ? 0 : componentToWatch;
|
||||
}
|
||||
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -1904,7 +1904,7 @@ public:
|
|||
it is running on the message thread.
|
||||
*/
|
||||
template <class ComponentType>
|
||||
class JUCE_API SafePointer : private ComponentListener
|
||||
class SafePointer : private ComponentListener
|
||||
{
|
||||
public:
|
||||
/** Creates a null SafePointer. */
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library - "Jules' Utility Class Extensions"
|
||||
Copyright 2004-9 by Raw Material Software Ltd.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
JUCE can be redistributed and/or modified under the terms of the GNU General
|
||||
Public License (Version 2), as published by the Free Software Foundation.
|
||||
A copy of the license is included in the JUCE distribution, or can be found
|
||||
online at www.gnu.org/licenses.
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.rawmaterialsoftware.com/juce for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
|
||||
#define __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
|
||||
|
||||
#include "juce_Component.h"
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Object for monitoring a component, and later testing whether it's still valid.
|
||||
|
||||
Slightly obscure, this one, but it's used internally for making sure that
|
||||
after some callbacks, a component hasn't been deleted. It's more reliable than
|
||||
just using isValidComponent(), which can provide false-positives if a new
|
||||
component is created at the same memory location as an old one.
|
||||
*/
|
||||
class JUCE_API ComponentDeletionWatcher
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Creates a watcher for a given component.
|
||||
|
||||
The component must be valid at the time it's passed in.
|
||||
*/
|
||||
ComponentDeletionWatcher (const Component* const componentToWatch) throw();
|
||||
|
||||
/** Destructor. */
|
||||
~ComponentDeletionWatcher() throw();
|
||||
|
||||
/** Returns true if the component has been deleted since the time that this
|
||||
object was created.
|
||||
*/
|
||||
bool hasBeenDeleted() const throw();
|
||||
|
||||
/** Returns the component that's being watched, or null if it has been deleted. */
|
||||
const Component* getComponent() const throw();
|
||||
|
||||
//==============================================================================
|
||||
juce_UseDebuggingNewOperator
|
||||
|
||||
private:
|
||||
const Component* const componentToWatch;
|
||||
const uint32 componentUID;
|
||||
|
||||
ComponentDeletionWatcher (const ComponentDeletionWatcher&);
|
||||
ComponentDeletionWatcher& operator= (const ComponentDeletionWatcher&);
|
||||
};
|
||||
|
||||
|
||||
#endif // __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
|
||||
|
|
@ -398,9 +398,6 @@
|
|||
#ifndef __JUCE_COMPONENT_JUCEHEADER__
|
||||
#include "gui/components/juce_Component.h"
|
||||
#endif
|
||||
#ifndef __JUCE_COMPONENTDELETIONWATCHER_JUCEHEADER__
|
||||
#include "gui/components/juce_ComponentDeletionWatcher.h"
|
||||
#endif
|
||||
#ifndef __JUCE_COMPONENTLISTENER_JUCEHEADER__
|
||||
#include "gui/components/juce_ComponentListener.h"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue