aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--embed/mozilla/EphyBrowser.cpp14
2 files changed, 14 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index db637d903..6f53bd9af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-05-15 Christian Persch <chpe@cvs.gnome.org>
+
+ * embed/mozilla/EphyBrowser.cpp:
+
+ Set mEventReceiver to nsnull in ::Destroy(), fixes a crasher.
+
2004-05-14 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/EphyContentPolicy.cpp:
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<nsIDOMEventTarget> 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;