mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 59ace8d80ce8
This commit is contained in:
parent
8dd5da1024
commit
9b15b69a1b
@ -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);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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; \
|
||||
|
@ -164,7 +164,7 @@ static nsCompressedMap gLowerMap = {
|
||||
nsCaseConversionImp2* nsCaseConversionImp2::GetInstance()
|
||||
{
|
||||
if (!gCaseConv)
|
||||
gCaseConv = new nsCaseConversionImp2();
|
||||
NS_NEWXPCOM(gCaseConv, nsCaseConversionImp2);
|
||||
return gCaseConv;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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; \
|
||||
|
@ -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));
|
||||
|
@ -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));
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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); \
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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; \
|
||||
|
@ -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) {
|
||||
|
@ -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; \
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -699,7 +699,7 @@ xptiInterfaceInfo::Release(void)
|
||||
mEntry = nsnull;
|
||||
}
|
||||
|
||||
delete this;
|
||||
NS_DELETEXPCOM(this);
|
||||
return 0;
|
||||
}
|
||||
return cnt;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user