Backed out changeset 59ace8d80ce8

This commit is contained in:
Dão Gottwald 2010-07-04 22:01:13 +02:00
parent 8dd5da1024
commit 9b15b69a1b
47 changed files with 111 additions and 64 deletions

View File

@ -131,7 +131,7 @@ void nsAccessNode::LastRelease()
NS_ASSERTION(!mWeakShell, "A Shutdown() impl forgot to call its parent's Shutdown?");
}
// ... then die.
delete this;
NS_DELETEXPCOM(this);
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -78,7 +78,7 @@ nsNullPrincipal::Release()
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
NS_LOG_RELEASE(this, count, "nsNullPrincipal");
if (count == 0) {
delete this;
NS_DELETEXPCOM(this);
}
return count;

View File

@ -166,7 +166,7 @@ nsPrincipal::Release()
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
NS_LOG_RELEASE(this, count, "nsPrincipal");
if (count == 0) {
delete this;
NS_DELETEXPCOM(this);
}
return count;

View File

@ -75,7 +75,7 @@ nsSystemPrincipal::Release()
nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mJSPrincipals.refcount);
NS_LOG_RELEASE(this, count, "nsSystemPrincipal");
if (count == 0) {
delete this;
NS_DELETEXPCOM(this);
}
return count;

View File

@ -1360,7 +1360,8 @@ nsXMLHttpRequest::GetAllResponseHeaders(char **_retval)
nsCOMPtr<nsIHttpChannel> httpChannel = GetCurrentHttpChannel();
if (httpChannel) {
nsHeaderVisitor *visitor = new nsHeaderVisitor();
nsHeaderVisitor *visitor = nsnull;
NS_NEWXPCOM(visitor, nsHeaderVisitor);
if (!visitor)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(visitor);

View File

@ -71,7 +71,8 @@ NS_NewXBLContentSink(nsIXMLContentSink** aResult,
{
NS_ENSURE_ARG_POINTER(aResult);
nsXBLContentSink* it = new nsXBLContentSink();
nsXBLContentSink* it;
NS_NEWXPCOM(it, nsXBLContentSink);
NS_ENSURE_TRUE(it, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIXMLContentSink> kungFuDeathGrip = it;

View File

@ -124,7 +124,8 @@ NS_NewXMLContentSink(nsIXMLContentSink** aResult,
if (nsnull == aResult) {
return NS_ERROR_NULL_POINTER;
}
nsXMLContentSink* it = new nsXMLContentSink();
nsXMLContentSink* it;
NS_NEWXPCOM(it, nsXMLContentSink);
if (nsnull == it) {
return NS_ERROR_OUT_OF_MEMORY;
}

View File

@ -909,7 +909,8 @@ nsClipboardDragDropHookCommand::GetCommandStateParams(const char *aCommandName,
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd = new _cmdClass(); \
_cmdClass* theCmd; \
NS_NEWXPCOM(theCmd, _cmdClass); \
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd)); \
@ -917,7 +918,8 @@ nsClipboardDragDropHookCommand::GetCommandStateParams(const char *aCommandName,
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd = new _cmdClass(); \
_cmdClass* theCmd; \
NS_NEWXPCOM(theCmd, _cmdClass); \
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));

View File

@ -44,7 +44,8 @@
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd = new _cmdClass(); \
_cmdClass* theCmd; \
NS_NEWXPCOM(theCmd, _cmdClass); \
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd)); \
@ -52,7 +53,8 @@
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd = new _cmdClass(); \
_cmdClass* theCmd; \
NS_NEWXPCOM(theCmd, _cmdClass); \
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));

View File

@ -84,7 +84,8 @@ nsComposeTxtSrvFilterConstructor(nsISupports *aOuter, REFNSIID aIID,
{
return NS_ERROR_NO_AGGREGATION;
}
nsComposeTxtSrvFilter * inst = new nsComposeTxtSrvFilter();
nsComposeTxtSrvFilter * inst;
NS_NEWXPCOM(inst, nsComposeTxtSrvFilter);
if (NULL == inst)
{
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -47,7 +47,8 @@
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd = new _cmdClass(); \
_cmdClass* theCmd; \
NS_NEWXPCOM(theCmd, _cmdClass); \
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd)); \
@ -55,7 +56,8 @@
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
{ \
_cmdClass* theCmd = new _cmdClass(); \
_cmdClass* theCmd; \
NS_NEWXPCOM(theCmd, _cmdClass); \
NS_ENSURE_TRUE(theCmd, NS_ERROR_OUT_OF_MEMORY); \
rv = inCommandTable->RegisterCommand(_cmdName, \
static_cast<nsIControllerCommand *>(theCmd));

View File

@ -70,7 +70,7 @@ nsrefcnt nsEditorTxnLog::Release(void)
{
NS_PRECONDITION(0 != mRefCnt, "dup release");
if (--mRefCnt == 0) {
delete this;
NS_DELETEXPCOM(this);
return 0;
}
return mRefCnt;

View File

@ -153,7 +153,7 @@ NS_IMETHODIMP nsWebBrowser::InternalDestroy()
if (mListenerArray) {
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
delete state;
NS_DELETEXPCOM(state);
}
delete mListenerArray;
mListenerArray = nsnull;
@ -237,14 +237,14 @@ NS_IMETHODIMP nsWebBrowser::AddWebBrowserListener(nsIWeakReference *aListener, c
// The window hasn't been created yet, so queue up the listener. They'll be
// registered when the window gets created.
nsAutoPtr<nsWebBrowserListenerState> state;
state = new nsWebBrowserListenerState();
NS_NEWXPCOM(state, nsWebBrowserListenerState);
if (!state) return NS_ERROR_OUT_OF_MEMORY;
state->mWeakPtr = aListener;
state->mID = aIID;
if (!mListenerArray) {
mListenerArray = new nsTArray<nsWebBrowserListenerState*>();
NS_NEWXPCOM(mListenerArray, nsTArray<nsWebBrowserListenerState*>);
if (!mListenerArray) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -315,9 +315,9 @@ NS_IMETHODIMP nsWebBrowser::RemoveWebBrowserListener(nsIWeakReference *aListener
if (0 >= mListenerArray->Length()) {
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
delete state;
NS_DELETEXPCOM(state);
}
delete mListenerArray;
NS_DELETEXPCOM(mListenerArray);
mListenerArray = nsnull;
}
@ -1172,9 +1172,9 @@ NS_IMETHODIMP nsWebBrowser::Create()
}
for (PRUint32 i = 0, end = mListenerArray->Length(); i < end; i++) {
nsWebBrowserListenerState *state = mListenerArray->ElementAt(i);
delete state;
NS_DELETEXPCOM(state);
}
delete mListenerArray;
NS_DELETEXPCOM(mListenerArray);
mListenerArray = nsnull;
}

View File

@ -69,7 +69,7 @@ NS_IMETHODIMP_(nsrefcnt) nsPrintProgress::Release(void)
mRefCnt = 1; /* stabilize */
/* enable this to find non-threadsafe destructors: */
/* NS_ASSERT_OWNINGTHREAD(nsPrintProgress); */
delete this;
NS_DELETEXPCOM(this);
return 0;
}
return count;

View File

@ -86,13 +86,15 @@ mozInlineSpellCheckerConstructor(nsISupports *aOuter, REFNSIID aIID,
nsresult rv;
mozInlineSpellChecker* inst;
*aResult = NULL;
if (NULL != aOuter) {
rv = NS_ERROR_NO_AGGREGATION;
return rv;
}
mozInlineSpellChecker* inst = new mozInlineSpellChecker();
NS_NEWXPCOM(inst, mozInlineSpellChecker);
if (NULL == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;

View File

@ -74,7 +74,8 @@ nsScriptableRegionConstructor(nsISupports *aOuter, REFNSIID aIID, void **aResult
return rv;
}
nsCOMPtr <nsIRegion> rgn = new nsThebesRegion();
nsCOMPtr <nsIRegion> rgn;
NS_NEWXPCOM(rgn, nsThebesRegion);
nsCOMPtr<nsIScriptableRegion> scriptableRgn;
if (rgn != nsnull)
{

View File

@ -104,7 +104,7 @@ public: \
NS_LOG_RELEASE(this, count, #_class); \
if (count == 0) { \
mRefCnt = 1; /* stabilize */ \
delete this; \
NS_DELETEXPCOM(this); \
return 0; \
} \
return count; \

View File

@ -164,7 +164,7 @@ static nsCompressedMap gLowerMap = {
nsCaseConversionImp2* nsCaseConversionImp2::GetInstance()
{
if (!gCaseConv)
gCaseConv = new nsCaseConversionImp2();
NS_NEWXPCOM(gCaseConv, nsCaseConversionImp2);
return gCaseConv;
}

View File

@ -237,7 +237,7 @@ do_decrement:
if(0 == cnt)
{
delete this; // also unlinks us from chain
NS_DELETEXPCOM(this); // also unlinks us from chain
return 0;
}
if(1 == cnt)

View File

@ -77,7 +77,7 @@ NS_IMETHODIMP_(nsrefcnt) xpctestNoisy::Release(void)
printf("Noisy %d - decremented refcount to %d\n", mID, mRefCnt.get());
NS_LOG_RELEASE(this, mRefCnt, "xpctestNoisy");
if (mRefCnt == 0) {
delete this;
NS_DELETEXPCOM(this);
return 0;
}
return mRefCnt;

View File

@ -789,7 +789,8 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow)
//
// now register ourselves as a focus listener, so that we get called
// when the focus changes in the window
nsDocViewerFocusListener *focusListener = new nsDocViewerFocusListener();
nsDocViewerFocusListener *focusListener;
NS_NEWXPCOM(focusListener, nsDocViewerFocusListener);
NS_ENSURE_TRUE(focusListener, NS_ERROR_OUT_OF_MEMORY);
focusListener->Init(this);

View File

@ -591,13 +591,15 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
{ \
nsresult rv; \
\
_InstanceClass * inst; \
\
*aResult = NULL; \
if (NULL != aOuter) { \
rv = NS_ERROR_NO_AGGREGATION; \
return rv; \
} \
\
_InstanceClass * inst = new _InstanceClass(); \
NS_NEWXPCOM(inst, _InstanceClass); \
if (NULL == inst) { \
rv = NS_ERROR_OUT_OF_MEMORY; \
return rv; \

View File

@ -142,7 +142,8 @@ nsBulletFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
if (newRequest) {
if (!mListener) {
nsBulletListener *listener = new nsBulletListener();
nsBulletListener *listener;
NS_NEWXPCOM(listener, nsBulletListener);
NS_ADDREF(listener);
listener->SetFrame(this);
listener->QueryInterface(NS_GET_IID(imgIDecoderObserver), getter_AddRefs(mListener));

View File

@ -222,7 +222,8 @@ nsImageBoxFrame::Init(nsIContent* aContent,
nsIFrame* aPrevInFlow)
{
if (!mListener) {
nsImageBoxListener *listener = new nsImageBoxListener();
nsImageBoxListener *listener;
NS_NEWXPCOM(listener, nsImageBoxListener);
NS_ADDREF(listener);
listener->SetFrame(this);
listener->QueryInterface(NS_GET_IID(imgIDecoderObserver), getter_AddRefs(mListener));

View File

@ -145,7 +145,7 @@ nsrefcnt nsJAR::Release(void)
mRefCnt = 1; /* stabilize */
/* enable this to find non-threadsafe destructors: */
/* NS_ASSERT_OWNINGTHREAD(nsJAR); */
delete this;
NS_DELETEXPCOM(this);
return 0;
}
else if (1 == count && mCache) {

View File

@ -94,7 +94,8 @@ NS_IMETHODIMP nsIconProtocolHandler::NewURI(const nsACString &aSpec,
nsIURI **result)
{
nsCOMPtr<nsIURI> uri = new nsMozIconURI();
nsCOMPtr<nsIURI> uri;
NS_NEWXPCOM(uri, nsMozIconURI);
if (!uri) return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = uri->SetSpec(aSpec);

View File

@ -661,7 +661,7 @@ nsresult imgLoader::CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup
if (aProxyRequest) {
proxyRequest = static_cast<imgRequestProxy *>(aProxyRequest);
} else {
proxyRequest = new imgRequestProxy();
NS_NEWXPCOM(proxyRequest, imgRequestProxy);
if (!proxyRequest) return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(proxyRequest);

View File

@ -80,7 +80,7 @@ NS_IMETHODIMP imgTools::DecodeImageData(nsIInputStream* aInStr,
NS_ENSURE_ARG_POINTER(aInStr);
// If the caller didn't provide a container, create one
if (!*aContainer) {
*aContainer = new imgContainer();
NS_NEWXPCOM(*aContainer, imgContainer);
if (!*aContainer)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aContainer);

View File

@ -288,7 +288,8 @@ nsMIMEInputStreamConstructor(nsISupports *outer, REFNSIID iid, void **result)
if (outer)
return NS_ERROR_NO_AGGREGATION;
nsMIMEInputStream *inst = new nsMIMEInputStream();
nsMIMEInputStream *inst;
NS_NEWXPCOM(inst, nsMIMEInputStream);
if (!inst)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -1675,7 +1675,8 @@ nsStandardURL::SchemeIs(const char *scheme, PRBool *result)
/* virtual */ nsStandardURL*
nsStandardURL::StartClone()
{
nsStandardURL *clone = new nsStandardURL();
nsStandardURL *clone;
NS_NEWXPCOM(clone, nsStandardURL);
return clone;
}

View File

@ -133,7 +133,8 @@ nsResURL::EnsureFile()
/* virtual */ nsStandardURL*
nsResURL::StartClone()
{
nsResURL *clone = new nsResURL();
nsResURL *clone;
NS_NEWXPCOM(clone, nsResURL);
return clone;
}
@ -335,7 +336,8 @@ nsResProtocolHandler::NewURI(const nsACString &aSpec,
{
nsresult rv;
nsResURL *resURL = new nsResURL();
nsResURL *resURL;
NS_NEWXPCOM(resURL, nsResURL);
if (!resURL)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(resURL);

View File

@ -106,7 +106,7 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
return NS_ERROR_FAILURE; \
} \
\
inst = new _InstanceClass(); \
NS_NEWXPCOM(inst, _InstanceClass); \
if (NULL == inst) { \
if (triggeredByNSSComponent) \
EnsureNSSInitialized(nssInitFailed); \
@ -155,7 +155,7 @@ _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
return NS_ERROR_FAILURE; \
} \
\
inst = new _InstanceClass(); \
NS_NEWXPCOM(inst, _InstanceClass); \
if (NULL == inst) { \
if (triggeredByNSSComponent) \
EnsureNSSInitialized(nssInitFailed); \

View File

@ -401,7 +401,8 @@ NS_IMETHODIMP nsExternalProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_
PRBool haveExternalHandler = HaveExternalProtocolHandler(aURI);
if (haveExternalHandler)
{
nsCOMPtr<nsIChannel> channel = new nsExtProtocolChannel();
nsCOMPtr<nsIChannel> channel;
NS_NEWXPCOM(channel, nsExtProtocolChannel);
if (!channel) return NS_ERROR_OUT_OF_MEMORY;
((nsExtProtocolChannel*) channel.get())->SetURI(aURI);

View File

@ -73,7 +73,7 @@ public:
NS_LOG_RELEASE(this, mRefCnt, "nsGtkIMModule");
if (mRefCnt == 0) {
mRefCnt = 1; /* stabilize */
delete this;
NS_DELETEXPCOM(this);
return 0;
}
return mRefCnt;

View File

@ -123,7 +123,7 @@ nsNativeThemeGTKConstructor(nsISupports *aOuter, REFNSIID aIID,
return rv;
}
inst = new nsNativeThemeGTK();
NS_NEWXPCOM(inst, nsNativeThemeGTK);
if (NULL == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;
@ -197,7 +197,7 @@ nsNativeKeyBindingsConstructor(nsISupports *aOuter, REFNSIID aIID,
return rv;
}
inst = new nsNativeKeyBindings();
NS_NEWXPCOM(inst, nsNativeKeyBindings);
if (NULL == inst) {
rv = NS_ERROR_OUT_OF_MEMORY;
return rv;

View File

@ -1217,7 +1217,7 @@ static nsresult nsRwsServiceInit(nsRwsService **aClass)
}
// create an instance of nsRwsService
sRwsInstance = new nsRwsService();
NS_NEWXPCOM(sRwsInstance, nsRwsService);
if (sRwsInstance == 0)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -95,7 +95,7 @@ nsNativeThemeQtConstructor(nsISupports *aOuter, REFNSIID aIID,
if (NULL != aOuter)
return NS_ERROR_NO_AGGREGATION;
inst = new nsNativeThemeQt();
NS_NEWXPCOM(inst, nsNativeThemeQt);
if (NULL == inst)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -155,7 +155,7 @@ _class::Internal::Release(void) \
NS_LOG_RELEASE(this, agg->mRefCnt, #_class); \
if (agg->mRefCnt == 0) { \
agg->mRefCnt = 1; /* stabilize */ \
delete agg; \
NS_DELETEXPCOM(agg); \
return 0; \
} \
return agg->mRefCnt; \
@ -188,7 +188,7 @@ _class::Internal::Release(void) \
NS_LOG_RELEASE(this, count, #_class); \
if (count == 0) { \
agg->mRefCnt.stabilizeForDeletion(this); \
delete agg; \
NS_DELETEXPCOM(agg); \
return 0; \
} \
return count; \

View File

@ -984,7 +984,7 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt,
}
}
// Here's the case where MOZ_COUNT_CTOR was not used,
// Here's the case where neither NS_NEWXPCOM nor MOZ_COUNT_CTOR were used,
// yet we still want to see creation information:
PRBool loggingThisType = (!gTypesToLog || LogThisType(aClazz));
@ -1068,7 +1068,7 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz)
}
}
// Here's the case where MOZ_COUNT_DTOR was not used,
// Here's the case where neither NS_DELETEXPCOM nor MOZ_COUNT_DTOR were used,
// yet we still want to see deletion information:
if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {

View File

@ -327,7 +327,7 @@ public: \
NS_LOG_RELEASE(this, mRefCnt, #_class); \
if (mRefCnt == 0) { \
mRefCnt = 1; /* stabilize */ \
delete this; \
NS_DELETEXPCOM(this); \
} \
} \
protected: \
@ -411,7 +411,7 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
* the refcount to |0|.
*/
#define NS_IMPL_RELEASE(_class) \
NS_IMPL_RELEASE_WITH_DESTROY(_class, delete (this))
NS_IMPL_RELEASE_WITH_DESTROY(_class, NS_DELETEXPCOM(this))
/**
* Use this macro to implement the Release method for a given <i>_class</i>
@ -465,10 +465,10 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, _destroy)
#define NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(_class, _basetype) \
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, delete (this))
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _basetype, NS_DELETEXPCOM(this))
#define NS_IMPL_CYCLE_COLLECTING_RELEASE(_class) \
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _class, delete (this))
NS_IMPL_CYCLE_COLLECTING_RELEASE_FULL(_class, _class, NS_DELETEXPCOM(this))
///////////////////////////////////////////////////////////////////////////////
@ -1278,7 +1278,7 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
mRefCnt = 1; /* stabilize */ \
/* enable this to find non-threadsafe destructors: */ \
/* NS_ASSERT_OWNINGTHREAD(_class); */ \
delete (this); \
NS_DELETEXPCOM(this); \
return 0; \
} \
return count; \

View File

@ -61,6 +61,27 @@
#include "nsISupportsImpl.h"
#endif
/**
* Macro for instantiating a new object that implements nsISupports.
* Note that you can only use this if you adhere to the no arguments
* constructor com policy (which you really should!).
* @param _result Where the new instance pointer is stored
* @param _type The type of object to call "new" with.
*/
#define NS_NEWXPCOM(_result,_type) \
PR_BEGIN_MACRO \
_result = new _type(); \
PR_END_MACRO
/**
* Macro for deleting an object that implements nsISupports.
* @param _ptr The object to delete.
*/
#define NS_DELETEXPCOM(_ptr) \
PR_BEGIN_MACRO \
delete (_ptr); \
PR_END_MACRO
/**
* Macro for adding a reference to an interface.
* @param _ptr The interface pointer.

View File

@ -306,7 +306,8 @@ NS_NewInputStreamTeeAsync(nsIInputStream **result,
{
nsresult rv;
nsCOMPtr<nsIInputStreamTee> tee = new nsInputStreamTee();
nsCOMPtr<nsIInputStreamTee> tee;
NS_NEWXPCOM(tee, nsInputStreamTee);
if (!tee)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -398,7 +398,8 @@ nsMultiplexInputStreamConstructor(nsISupports *outer,
if (outer)
return NS_ERROR_NO_AGGREGATION;
nsMultiplexInputStream *inst = new nsMultiplexInputStream();
nsMultiplexInputStream *inst;
NS_NEWXPCOM(inst, nsMultiplexInputStream);
if (!inst)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -113,7 +113,7 @@ nsProxyEventObject::Release(void)
// call the destructor outside of the lock so that we aren't holding the
// lock when we release the object
delete this;
NS_DELETEXPCOM(this);
return 0;
}

View File

@ -699,7 +699,7 @@ xptiInterfaceInfo::Release(void)
mEntry = nsnull;
}
delete this;
NS_DELETEXPCOM(this);
return 0;
}
return cnt;

View File

@ -150,7 +150,7 @@ Bar::Release(void)
NS_LOG_RELEASE(this, mRefCnt, "Bar");
if (mRefCnt == 0) {
mRefCnt = 1; /* stabilize */
delete this;
NS_DELETEXPCOM(this);
return 0;
}
return mRefCnt;

View File

@ -91,7 +91,7 @@ NS_IMETHODIMP_(nsrefcnt) nsTimerImpl::Release(void)
/* enable this to find non-threadsafe destructors: */
/* NS_ASSERT_OWNINGTHREAD(nsTimerImpl); */
delete this;
NS_DELETEXPCOM(this);
return 0;
}