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
parent 4b69a276d4
commit b043c32699
3 changed files with 17 additions and 0 deletions

View File

@ -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)

View File

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

View File

@ -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