From 6ab2a76e688ec74acd9b75ab19a0d138250931eb Mon Sep 17 00:00:00 2001 From: "dougt%netscape.com" Date: Sun, 2 Sep 2001 17:15:16 +0000 Subject: [PATCH] backing out my changes due to linux orangeness git-svn-id: svn://10.0.0.236/trunk@102177 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/proxy/src/nsProxyEvent.cpp | 64 +++++++++++------------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/mozilla/xpcom/proxy/src/nsProxyEvent.cpp b/mozilla/xpcom/proxy/src/nsProxyEvent.cpp index b98987e4f99..c9e15b794fd 100644 --- a/mozilla/xpcom/proxy/src/nsProxyEvent.cpp +++ b/mozilla/xpcom/proxy/src/nsProxyEvent.cpp @@ -403,44 +403,22 @@ nsProxyObject::Post( PRUint32 methodIndex, nsXPTMethodInfo *methodInfo, nsXPTCMi if (methodInfo->IsNotXPCOM()) return NS_ERROR_PROXY_INVALID_IN_PARAMETER; + + PLEvent *event = PR_NEW(PLEvent); + + if (event == nsnull) + return NS_ERROR_OUT_OF_MEMORY; + nsXPTCVariant *fullParam; uint8 paramCount; rv = convertMiniVariantToVariant(methodInfo, params, &fullParam, ¶mCount); if (NS_FAILED(rv)) - return rv; - - if (!fullParam) - return NS_ERROR_FAILURE; - - PRBool callDirectly; - - // see if we should call into the method directly. Either it is a QI function call - // (methodIndex == 0), or it is a sync proxy and this code is running on the same thread - // as the destination event queue. - if ( (methodIndex == 0) || - (mProxyType & PROXY_SYNC && - NS_SUCCEEDED(mDestQueue->IsQueueOnCurrentThread(&callDirectly)) && - callDirectly)) { - - // invoke the magic of xptc... - nsresult rv = XPTC_InvokeByIndex( mRealObject, - methodIndex, - paramCount, - fullParam); - - free(fullParam); // allocated with malloc + PR_DELETE(event); return rv; } - PLEvent *event = PR_NEW(PLEvent); - - if (event == nsnull) { - free(fullParam); - return NS_ERROR_OUT_OF_MEMORY; - } - nsProxyObjectCallInfo *proxyInfo = new nsProxyObjectCallInfo(this, methodInfo, methodIndex, @@ -449,7 +427,12 @@ nsProxyObject::Post( PRUint32 methodIndex, nsXPTMethodInfo *methodInfo, nsXPTCMi event); // will be deleted by ~() if (proxyInfo == nsnull) - return NS_ERROR_OUT_OF_MEMORY; + { + PR_DELETE(event); + if (fullParam) + free(fullParam); // allocated with malloc + return NS_ERROR_OUT_OF_MEMORY; + } PL_InitEvent(event, proxyInfo, @@ -458,11 +441,24 @@ nsProxyObject::Post( PRUint32 methodIndex, nsXPTMethodInfo *methodInfo, nsXPTCMi if (mProxyType & PROXY_SYNC) { - rv = PostAndWait(proxyInfo); + PRBool callDirectly; + mDestQueue->IsQueueOnCurrentThread(&callDirectly); + + if (callDirectly) + { + EventHandler(event); + PL_DestroyEvent(event); + // there is no need to call the DestroyHandler() because + // there is no need to wake up the nested event loop. + } + else + { + rv = PostAndWait(proxyInfo); + + if (NS_FAILED(rv)) + return rv; + } - if (NS_FAILED(rv)) - return rv; - rv = proxyInfo->GetResult(); delete proxyInfo; return rv;