mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 02:57:38 +00:00
Bug 827596 - assert at runtime if we try to assign to a nsAutoPtr which already contains the identical pointer, r=dbaron
This commit is contained in:
parent
556583510c
commit
e883da27fb
@ -34,8 +34,12 @@ class nsAutoPtr
|
||||
void
|
||||
assign( T* newPtr )
|
||||
{
|
||||
NS_ABORT_IF_FALSE(mRawPtr != newPtr || !newPtr, "This makes no sense!");
|
||||
T* oldPtr = mRawPtr;
|
||||
|
||||
if (newPtr != nullptr && newPtr == oldPtr) {
|
||||
NS_RUNTIMEABORT("Logic flaw in the caller");
|
||||
}
|
||||
|
||||
mRawPtr = newPtr;
|
||||
delete oldPtr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user