changed the mechanism underlying |do_QueryInterface| to decouple |nsCOMPtr| from services, |nsIWeakReference|, etc. This change fixes bug #17364, and paves the way for making |nsCOMPtr| cooperate with services. r=valeski (additional builds done by dmose and syd)

git-svn-id: svn://10.0.0.236/trunk@52346 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
scc%netscape.com
1999-10-31 00:35:48 +00:00
parent 3872148e22
commit 65b7cd0c03
10 changed files with 320 additions and 213 deletions

View File

@@ -17,7 +17,21 @@
*/
#include "nsCOMPtr.h"
#include "nsIWeakReference.h"
// #include "nsIWeakReference.h"
nsresult
nsQueryInterface::operator()( const nsIID& aIID, void** answer ) const
{
nsresult status;
if ( mRawPtr )
status = mRawPtr->QueryInterface(aIID, answer);
else
status = NS_ERROR_NULL_POINTER;
if ( mErrorPtr )
*mErrorPtr = status;
return status;
}
#ifdef NSCAP_FEATURE_FACTOR_DESTRUCTOR
nsCOMPtr_base::~nsCOMPtr_base()
@@ -37,6 +51,19 @@ nsCOMPtr_base::assign_with_AddRef( nsISupports* rawPtr )
mRawPtr = rawPtr;
}
void
nsCOMPtr_base::assign_from_helper( const nsCOMPtr_helper& helper, const nsIID& iid )
{
nsISupports* newRawPtr;
if ( !NS_SUCCEEDED( helper(iid, NSCAP_REINTERPRET_CAST(void**, &newRawPtr)) ) )
newRawPtr = 0;
if ( mRawPtr )
NSCAP_RELEASE(mRawPtr);
mRawPtr = newRawPtr;
}
#if 0
void
nsCOMPtr_base::assign_with_QueryInterface( nsISupports* rawPtr, const nsIID& iid, nsresult* result )
{
@@ -70,6 +97,7 @@ nsCOMPtr_base::assign_with_QueryReferent( nsIWeakReference* weakPtr, const nsIID
if ( result )
*result = status;
}
#endif
void**
nsCOMPtr_base::begin_assignment()