Made a protected method for severing weak references early
git-svn-id: svn://10.0.0.236/trunk@48602 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
9b023f2539
commit
240063823f
@ -51,6 +51,10 @@ class NS_COM nsSupportsWeakReference : public nsISupportsWeakReference
|
||||
}
|
||||
|
||||
nsWeakReference* mProxy;
|
||||
|
||||
protected:
|
||||
|
||||
inline void ClearWeakReferences();
|
||||
};
|
||||
|
||||
class NS_COM nsWeakReference : public nsIWeakReference
|
||||
@ -93,10 +97,27 @@ class NS_COM nsWeakReference : public nsIWeakReference
|
||||
nsSupportsWeakReference* mReferent;
|
||||
};
|
||||
|
||||
inline nsSupportsWeakReference::~nsSupportsWeakReference()
|
||||
inline
|
||||
void
|
||||
nsSupportsWeakReference::ClearWeakReferences()
|
||||
/*
|
||||
Usually being called from |nsSupportsWeakReference::~nsSupportsWeakReference|
|
||||
will be good enough, but you may have a case where you need to call disconnect
|
||||
your weak references in an outer destructor (to prevent some client holding a
|
||||
weak reference from re-entering your destructor).
|
||||
*/
|
||||
{
|
||||
if ( mProxy )
|
||||
{
|
||||
mProxy->NoticeReferentDestruction();
|
||||
mProxy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
nsSupportsWeakReference::~nsSupportsWeakReference()
|
||||
{
|
||||
if ( mProxy )
|
||||
mProxy->NoticeReferentDestruction();
|
||||
ClearWeakReferences();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -51,6 +51,10 @@ class NS_COM nsSupportsWeakReference : public nsISupportsWeakReference
|
||||
}
|
||||
|
||||
nsWeakReference* mProxy;
|
||||
|
||||
protected:
|
||||
|
||||
inline void ClearWeakReferences();
|
||||
};
|
||||
|
||||
class NS_COM nsWeakReference : public nsIWeakReference
|
||||
@ -93,10 +97,27 @@ class NS_COM nsWeakReference : public nsIWeakReference
|
||||
nsSupportsWeakReference* mReferent;
|
||||
};
|
||||
|
||||
inline nsSupportsWeakReference::~nsSupportsWeakReference()
|
||||
inline
|
||||
void
|
||||
nsSupportsWeakReference::ClearWeakReferences()
|
||||
/*
|
||||
Usually being called from |nsSupportsWeakReference::~nsSupportsWeakReference|
|
||||
will be good enough, but you may have a case where you need to call disconnect
|
||||
your weak references in an outer destructor (to prevent some client holding a
|
||||
weak reference from re-entering your destructor).
|
||||
*/
|
||||
{
|
||||
if ( mProxy )
|
||||
{
|
||||
mProxy->NoticeReferentDestruction();
|
||||
mProxy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
nsSupportsWeakReference::~nsSupportsWeakReference()
|
||||
{
|
||||
if ( mProxy )
|
||||
mProxy->NoticeReferentDestruction();
|
||||
ClearWeakReferences();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user