зеркало из https://github.com/mozilla/pjs.git
Fix bug 315246: nsGetInterface::operator() can use an uninitialized nsresult variable, if the source fails to implement nsIInterfaceRequestor (which fires an assertion in debug builds). r=dougt, sr=bzbarsky.
This commit is contained in:
Родитель
d8196b6b42
Коммит
2254bafe1b
|
@ -42,23 +42,25 @@
|
||||||
nsresult
|
nsresult
|
||||||
nsGetInterface::operator()( const nsIID& aIID, void** aInstancePtr ) const
|
nsGetInterface::operator()( const nsIID& aIID, void** aInstancePtr ) const
|
||||||
{
|
{
|
||||||
nsresult status;
|
nsresult status;
|
||||||
|
|
||||||
if ( mSource )
|
if ( mSource )
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIInterfaceRequestor> factoryPtr = do_QueryInterface(mSource, &status);
|
nsCOMPtr<nsIInterfaceRequestor> factoryPtr = do_QueryInterface(mSource, &status);
|
||||||
NS_ASSERTION(factoryPtr, "Did you know you were calling |do_GetInterface()| on an object that doesn't support the |nsIInterfaceRequestor| interface?");
|
NS_ASSERTION(factoryPtr, "Did you know you were calling |do_GetInterface()| on an object that doesn't support the |nsIInterfaceRequestor| interface?");
|
||||||
|
|
||||||
if ( factoryPtr )
|
if ( factoryPtr )
|
||||||
status = factoryPtr->GetInterface(aIID, aInstancePtr);
|
status = factoryPtr->GetInterface(aIID, aInstancePtr);
|
||||||
|
else
|
||||||
|
status = NS_ERROR_NO_INTERFACE;
|
||||||
|
|
||||||
if ( NS_FAILED(status) )
|
if ( NS_FAILED(status) )
|
||||||
*aInstancePtr = 0;
|
*aInstancePtr = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
status = NS_ERROR_NULL_POINTER;
|
status = NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
if ( mErrorPtr )
|
if ( mErrorPtr )
|
||||||
*mErrorPtr = status;
|
*mErrorPtr = status;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче