Bug 865569 - Poison nsView. r=roc

This commit is contained in:
Mats Palmgren 2013-04-29 14:11:04 +02:00
parent aa60079743
commit 19ebf3187f

View File

@ -9,13 +9,10 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/Likely.h"
#include "nsIWidget.h"
#include "nsWidgetsCID.h"
#include "nsViewManager.h"
#include "nsIFrame.h"
#include "nsGUIEvent.h"
#include "nsIComponentManager.h"
#include "nsGfxCIID.h"
#include "nsIInterfaceRequestor.h"
#include "nsPresArena.h"
#include "nsXULPopupManager.h"
#include "nsIWidgetListener.h"
@ -134,7 +131,16 @@ nsView* nsView::GetViewFor(nsIWidget* aWidget)
void nsView::Destroy()
{
delete this;
this->~nsView();
const uintptr_t POISON = nsPresArena::GetPoisonValue();
char* p = reinterpret_cast<char*>(this);
char* limit = p + sizeof(*this);
for (; p < limit; p += sizeof(uintptr_t)) {
*reinterpret_cast<uintptr_t*>(p) = POISON;
}
nsView::operator delete(this);
}
void nsView::SetPosition(nscoord aX, nscoord aY)