mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout changeset bc2bbe9836c7 (bug 834769) for bustage.
This commit is contained in:
parent
615ad95018
commit
7946ac6e85
@ -36,20 +36,19 @@ template<typename T> OutParamRef<T> byRef(RefPtr<T>&);
|
||||
* live RefCounted<T> are controlled by RefPtr<T> and
|
||||
* RefPtr<super/subclass of T>. Upon a transition from refcounted==1
|
||||
* to 0, the RefCounted<T> "dies" and is destroyed. The "destroyed"
|
||||
* state is represented in DEBUG builds by refcount==0xffffdead. This
|
||||
* state is represented in DEBUG builds by refcount==-0xdead. This
|
||||
* state distinguishes use-before-ref (refcount==0) from
|
||||
* use-after-destroy (refcount==0xffffdead).
|
||||
* use-after-destroy (refcount==-0xdead).
|
||||
*/
|
||||
template<typename T>
|
||||
class RefCounted
|
||||
{
|
||||
friend class RefPtr<T>;
|
||||
|
||||
protected:
|
||||
RefCounted() : refCnt(0) { }
|
||||
~RefCounted() { MOZ_ASSERT(refCnt == 0xffffdead); }
|
||||
|
||||
public:
|
||||
RefCounted() : refCnt(0) { }
|
||||
~RefCounted() { MOZ_ASSERT(refCnt == -0xdead); }
|
||||
|
||||
// Compatibility with nsRefPtr.
|
||||
void AddRef() {
|
||||
MOZ_ASSERT(refCnt >= 0);
|
||||
@ -60,7 +59,7 @@ class RefCounted
|
||||
MOZ_ASSERT(refCnt > 0);
|
||||
if (0 == --refCnt) {
|
||||
#ifdef DEBUG
|
||||
refCnt = 0xffffdead;
|
||||
refCnt = -0xdead;
|
||||
#endif
|
||||
delete static_cast<T*>(this);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user