Bug 403199. Don't log addref/release of nsSimpleNestedURI, becuse it doesn't work right when someone addrefs the derived class but releases the base class canonical nsISupports, due to aggregation. r=dbaron

This commit is contained in:
Boris Zbarsky 2009-04-09 14:01:16 -04:00
parent e99ee04391
commit 1cd43cc746
2 changed files with 22 additions and 3 deletions

View File

@ -41,7 +41,10 @@
#include "nsIObjectOutputStream.h"
#include "nsNetUtil.h"
NS_IMPL_ISUPPORTS_INHERITED1(nsSimpleNestedURI, nsSimpleURI, nsINestedURI)
// nsSimpleURI uses aggregation, so use the non-logging addref/release macros.
NS_IMPL_QUERY_INTERFACE_INHERITED1(nsSimpleNestedURI, nsSimpleURI, nsINestedURI)
NS_IMPL_NONLOGGING_ADDREF_INHERITED(nsSimpleNestedURI, nsSimpleURI)
NS_IMPL_NONLOGGING_RELEASE_INHERITED(nsSimpleNestedURI, nsSimpleURI)
nsSimpleNestedURI::nsSimpleNestedURI(nsIURI* innerURI)
: nsSimpleURI(nsnull),

View File

@ -822,7 +822,7 @@ NS_IMETHODIMP_(nsrefcnt) Class::AddRef(void) \
nsrefcnt r = Super::AddRef(); \
NS_LOG_ADDREF(this, r, #Class, sizeof(*this)); \
return r; \
} \
}
#define NS_IMPL_RELEASE_INHERITED(Class, Super) \
NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \
@ -830,7 +830,23 @@ NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \
nsrefcnt r = Super::Release(); \
NS_LOG_RELEASE(this, r, #Class); \
return r; \
} \
}
/**
* As above but not logging the addref/release; needed if the base
* class might be aggregated.
*/
#define NS_IMPL_NONLOGGING_ADDREF_INHERITED(Class, Super) \
NS_IMETHODIMP_(nsrefcnt) Class::AddRef(void) \
{ \
return Super::AddRef(); \
}
#define NS_IMPL_NONLOGGING_RELEASE_INHERITED(Class, Super) \
NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \
{ \
return Super::Release(); \
}
#define NS_INTERFACE_TABLE_INHERITED0(Class) /* Nothing to do here */