diff --git a/xpcom/base/nsAgg.h b/xpcom/base/nsAgg.h index 6c5fe76859eb..f9cf4050eb3a 100644 --- a/xpcom/base/nsAgg.h +++ b/xpcom/base/nsAgg.h @@ -143,8 +143,7 @@ _class::Internal::AddRef(void) \ { \ _class* agg = NS_CYCLE_COLLECTION_CLASSNAME(_class)::Downcast(this); \ MOZ_ASSERT(int32_t(agg->mRefCnt) >= 0, "illegal refcnt"); \ - NS_CheckThreadSafe(agg->_mOwningThread.GetThread(), \ - #_class " not thread-safe"); \ + NS_ASSERT_OWNINGTHREAD_AGGREGATE(agg, _class); \ nsrefcnt count = agg->mRefCnt.incr(); \ NS_LOG_ADDREF(this, count, #_class, sizeof(*agg)); \ return count; \ @@ -154,8 +153,7 @@ _class::Internal::Release(void) \ { \ _class* agg = NS_CYCLE_COLLECTION_CLASSNAME(_class)::Downcast(this); \ MOZ_ASSERT(int32_t(agg->mRefCnt) > 0, "dup release"); \ - NS_CheckThreadSafe(agg->_mOwningThread.GetThread(), \ - #_class " not thread-safe"); \ + NS_ASSERT_OWNINGTHREAD_AGGREGATE(agg, _class); \ nsrefcnt count = agg->mRefCnt.decr(this); \ NS_LOG_RELEASE(this, count, #_class); \ return count; \ diff --git a/xpcom/glue/nsISupportsImpl.h b/xpcom/glue/nsISupportsImpl.h index 9450d7d58e68..932cd15cc30e 100644 --- a/xpcom/glue/nsISupportsImpl.h +++ b/xpcom/glue/nsISupportsImpl.h @@ -61,11 +61,13 @@ private: }; #define NS_DECL_OWNINGTHREAD nsAutoOwningThread _mOwningThread; -#define NS_ASSERT_OWNINGTHREAD(_class) \ - NS_CheckThreadSafe(_mOwningThread.GetThread(), #_class " not thread-safe") +#define NS_ASSERT_OWNINGTHREAD_AGGREGATE(agg, _class) \ + NS_CheckThreadSafe(agg->_mOwningThread.GetThread(), #_class " not thread-safe") +#define NS_ASSERT_OWNINGTHREAD(_class) NS_ASSERT_OWNINGTHREAD_AGGREGATE(this, _class) #else // !DEBUG && !NIGHTLY_BUILD #define NS_DECL_OWNINGTHREAD /* nothing */ +#define NS_ASSERT_OWNINGTHREAD_AGGREGATE(agg, _class) ((void)0) #define NS_ASSERT_OWNINGTHREAD(_class) ((void)0) #endif // DEBUG || NIGHTLY_BUILD