Bug 429233 - Firefox leaks nsTArray_base due to nsDOMKeyboardEvent's dtor not being virtual; also makes ~nsEvent virtual as well and uses MOZ_COUNT_[CD]TOR in nsEvent. Patch by Ben Turner <bent.mozilla@gmail.com>, r+sr=jst, a=beltzner

This commit is contained in:
jwalden@mit.edu 2008-04-17 15:38:35 -07:00
Родитель e619daaa68
Коммит 7de684a245
3 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -57,6 +57,14 @@ nsDOMKeyboardEvent::nsDOMKeyboardEvent(nsPresContext* aPresContext,
}
}
nsDOMKeyboardEvent::~nsDOMKeyboardEvent()
{
if (mEventIsInternal) {
delete static_cast<nsKeyEvent*>(mEvent);
mEvent = nsnull;
}
}
NS_IMPL_ADDREF_INHERITED(nsDOMKeyboardEvent, nsDOMUIEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMKeyboardEvent, nsDOMUIEvent)

Просмотреть файл

@ -47,6 +47,7 @@ class nsDOMKeyboardEvent : public nsIDOMKeyEvent,
{
public:
nsDOMKeyboardEvent(nsPresContext* aPresContext, nsKeyEvent* aEvent);
virtual ~nsDOMKeyboardEvent();
NS_DECL_ISUPPORTS_INHERITED

Просмотреть файл

@ -57,6 +57,7 @@
#include "nsWeakPtr.h"
#include "nsIWidget.h"
#include "nsTArray.h"
#include "nsTraceRefcnt.h"
class nsIRenderingContext;
class nsIRegion;
@ -394,6 +395,7 @@ protected:
flags(isTrusted ? NS_EVENT_FLAG_TRUSTED : NS_EVENT_FLAG_NONE),
userType(0)
{
MOZ_COUNT_CTOR(nsEvent);
}
public:
@ -405,6 +407,12 @@ public:
flags(isTrusted ? NS_EVENT_FLAG_TRUSTED : NS_EVENT_FLAG_NONE),
userType(0)
{
MOZ_COUNT_CTOR(nsEvent);
}
~nsEvent()
{
MOZ_COUNT_DTOR(nsEvent);
}
// See event struct types