зеркало из https://github.com/mozilla/gecko-dev.git
Bug 709747 - Support nsCOMPtr<T>::forget(I**); r=bsmedberg
This commit is contained in:
Родитель
c7eec081e4
Коммит
b2b42ad049
|
@ -767,15 +767,17 @@ class nsCOMPtr MOZ_FINAL
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename I>
|
||||||
void
|
void
|
||||||
forget( T** rhs NS_OUTPARAM )
|
forget( I** rhs NS_OUTPARAM )
|
||||||
// Set the target of rhs to the value of mRawPtr and null out mRawPtr.
|
// Set the target of rhs to the value of mRawPtr and null out mRawPtr.
|
||||||
// Useful to avoid unnecessary AddRef/Release pairs with "out"
|
// Useful to avoid unnecessary AddRef/Release pairs with "out"
|
||||||
// parameters.
|
// parameters where rhs bay be a T** or an I** where I is a base class
|
||||||
|
// of T.
|
||||||
{
|
{
|
||||||
NS_ASSERTION(rhs, "Null pointer passed to forget!");
|
NS_ASSERTION(rhs, "Null pointer passed to forget!");
|
||||||
*rhs = 0;
|
*rhs = get();
|
||||||
swap(*rhs);
|
mRawPtr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
T*
|
T*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче