diff --git a/content/events/src/nsDOMBeforeUnloadEvent.cpp b/content/events/src/nsDOMBeforeUnloadEvent.cpp index 3a51500e591..99193648efd 100644 --- a/content/events/src/nsDOMBeforeUnloadEvent.cpp +++ b/content/events/src/nsDOMBeforeUnloadEvent.cpp @@ -59,6 +59,11 @@ nsDOMBeforeUnloadEvent::nsDOMBeforeUnloadEvent(nsPresContext* aPresContext, nsDOMBeforeUnloadEvent::~nsDOMBeforeUnloadEvent() { + if (mEventIsInternal && + mEvent->eventStructType == NS_BEFORE_PAGE_UNLOAD_EVENT) { + delete static_cast(mEvent); + mEvent = nsnull; + } } NS_IMPL_ADDREF_INHERITED(nsDOMBeforeUnloadEvent, nsDOMEvent) diff --git a/content/events/src/nsDOMCommandEvent.cpp b/content/events/src/nsDOMCommandEvent.cpp index b7c3ca4c3c4..bd47d02a0c8 100644 --- a/content/events/src/nsDOMCommandEvent.cpp +++ b/content/events/src/nsDOMCommandEvent.cpp @@ -51,6 +51,14 @@ nsDOMCommandEvent::nsDOMCommandEvent(nsPresContext* aPresContext, } } +nsDOMCommandEvent::~nsDOMCommandEvent() +{ + if (mEventIsInternal && mEvent->eventStructType == NS_COMMAND_EVENT) { + delete static_cast(mEvent); + mEvent = nsnull; + } +} + NS_INTERFACE_MAP_BEGIN(nsDOMCommandEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMCommandEvent) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(CommandEvent) diff --git a/content/events/src/nsDOMCommandEvent.h b/content/events/src/nsDOMCommandEvent.h index 1700d537eb8..69c47f39c16 100644 --- a/content/events/src/nsDOMCommandEvent.h +++ b/content/events/src/nsDOMCommandEvent.h @@ -47,6 +47,7 @@ class nsDOMCommandEvent : public nsDOMEvent, public: nsDOMCommandEvent(nsPresContext* aPresContext, nsCommandEvent* aEvent); + virtual ~nsDOMCommandEvent(); NS_DECL_ISUPPORTS_INHERITED