I have the following QI map:
NS_INTERFACE_MAP_BEGIN(nsFtpControlConnection)
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
NS_INTERFACE_MAP_ENTRY(nsIStreamProvider)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIStreamObserver, nsIStreamListener)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStreamListener)
NS_INTERFACE_MAP_END_THREADSAFE
with
class nsFtpControlConnection : public nsIStreamListener, public
nsIStreamProvider { ... }
The following code works:
nsFtpControlConnection *fcc = ...
nsCOMPtr<nsISupports> sup1 = (nsIStreamListener*) fcc;
nsCOMPtr<nsISupports> sup2 = (nsIStreamProvider*) fcc;
nsCOMPtr<nsIStreamObserver> obs1 = (nsIStreamListener*) fcc;
However, this line does not:
nsCOMPtr<nsIStreamObserver> obs2 = (nsIStreamProvider*) fcc;
It hits the nsCOMPtr assertion:
###!!! ASSERTION: QueryInterface needed: 'query_result.get() ==
mRawPtr', file ../../../../dist/include/nsCOMPtr.h, line 499
I am confused why this is happening? I'm hoping that someone could
enlighten me... thanks!
Darin