From bc2707c6d4155c9a9a251cfdc2db86c1e097ea35 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 15 May 2004 16:20:12 +0000 Subject: Set mEventReceiver to nsnull too in ::Destroy(), fixes a crasher. 2004-05-15 Christian Persch * embed/mozilla/EphyBrowser.cpp: Set mEventReceiver to nsnull too in ::Destroy(), fixes a crasher. --- ChangeLog | 6 ++++++ embed/mozilla/EphyBrowser.cpp | 18 +++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 235388893..fcd9bd188 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-05-15 Christian Persch + + * embed/mozilla/EphyBrowser.cpp: + + Set mEventReceiver to nsnull too in ::Destroy(), fixes a crasher. + 2004-05-14 Christian Persch * embed/mozilla/EphyContentPolicy.cpp: diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index 9530b346c..061eba80c 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -26,6 +26,7 @@ #include "GlobalHistory.h" #include "ephy-embed.h" #include "ephy-string.h" +#include "ephy-debug.h" #include #include @@ -84,12 +85,14 @@ #include "ContentHandler.h" EphyEventListener::EphyEventListener(void) +: mOwner(nsnull) { - mOwner = nsnull; + LOG ("EphyEventListener ctor (%p)", this) } EphyEventListener::~EphyEventListener() { + LOG ("EphyEventListener dtor (%p)", this) } NS_IMPL_ISUPPORTS1(EphyEventListener, nsIDOMEventListener) @@ -184,11 +187,10 @@ EphyPopupEventListener::HandleEvent(nsIDOMEvent* aDOMEvent) } EphyBrowser::EphyBrowser () +: mFaviconEventListener(nsnull) +, mPopupEventListener(nsnull) +, mInitialized(PR_FALSE) { - mFaviconEventListener = nsnull; - mPopupEventListener = nsnull; - mEventReceiver = nsnull; - mInitialized = PR_FALSE; } EphyBrowser::~EphyBrowser () @@ -282,10 +284,11 @@ EphyBrowser::DetachListeners(void) { nsresult rv; - NS_ENSURE_TRUE (mEventReceiver, NS_ERROR_FAILURE); - + if (!mEventReceiver) return NS_OK; + nsCOMPtr target; target = do_QueryInterface (mEventReceiver); + NS_ENSURE_TRUE (target, NS_ERROR_FAILURE); rv = target->RemoveEventListener(NS_LITERAL_STRING("DOMLinkAdded"), mFaviconEventListener, PR_FALSE); @@ -395,6 +398,7 @@ nsresult EphyBrowser::Destroy () mWebBrowser = nsnull; mDOMWindow = nsnull; + mEventReceiver = nsnull; mInitialized = PR_FALSE; -- cgit v1.2.3