From d4f9632a7f0086ba17d23893a41a1fb6e7ed29ef Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 15 May 2004 16:21:44 +0000 Subject: Set mEventReceiver to nsnull in ::Destroy(), fixes a crasher. 2004-05-15 Christian Persch * embed/mozilla/EphyBrowser.cpp: Set mEventReceiver to nsnull in ::Destroy(), fixes a crasher. --- embed/mozilla/EphyBrowser.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'embed') diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index af0702ba1..901a98b29 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -78,9 +78,9 @@ #endif EphyEventListener::EphyEventListener(void) +: mOwner(nsnull) { LOG ("EphyEventListener ctor (%p)", this) - mOwner = nsnull; } EphyEventListener::~EphyEventListener() @@ -164,10 +164,10 @@ EphyFaviconEventListener::HandleEvent(nsIDOMEvent* aDOMEvent) } EphyBrowser::EphyBrowser () +: mFaviconEventListener(nsnull) +, mPopupEventListener(nsnull) +, mInitialized(PR_FALSE) { - mFaviconEventListener = nsnull; - mEventReceiver = nsnull; - mInitialized = PR_FALSE; } EphyBrowser::~EphyBrowser () @@ -256,10 +256,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); @@ -365,6 +366,7 @@ nsresult EphyBrowser::Destroy () mWebBrowser = nsnull; mDOMWindow = nsnull; + mEventReceiver = nsnull; mInitialized = PR_FALSE; -- cgit v1.2.3