From 7c0b959f0387ff24b16ef566813e61bdd9734705 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 27 Jan 2004 12:48:55 +0000 Subject: Make sure to not initialize EphyBrowser multiple times. 2004-01-27 Marco Pesenti Gritti * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: Make sure to not initialize EphyBrowser multiple times. --- embed/mozilla/EphyBrowser.cpp | 7 ++++++- embed/mozilla/EphyBrowser.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'embed/mozilla') diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index cd6d18f7c..4f8e31246 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -190,7 +190,8 @@ EphyBrowser::EphyBrowser () { mFaviconEventListener = nsnull; mPopupEventListener = nsnull; - mEventReceiver = nsnull; + mEventReceiver = nsnull; + mInitialized = PR_FALSE; } EphyBrowser::~EphyBrowser () @@ -201,6 +202,8 @@ nsresult EphyBrowser::Init (GtkMozEmbed *mozembed) { nsresult rv; + if (mInitialized) return NS_OK; + gtk_moz_embed_get_nsIWebBrowser (mozembed, getter_AddRefs(mWebBrowser)); NS_ENSURE_TRUE (mWebBrowser, NS_ERROR_FAILURE); @@ -228,6 +231,8 @@ nsresult EphyBrowser::Init (GtkMozEmbed *mozembed) rv = GetListener(); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); + mInitialized = PR_TRUE; + return AttachListeners(); } diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h index 40101ce44..0f3a89d85 100644 --- a/embed/mozilla/EphyBrowser.h +++ b/embed/mozilla/EphyBrowser.h @@ -130,6 +130,7 @@ private: nsCOMPtr mDOMWindow; EphyFaviconEventListener *mFaviconEventListener; EphyPopupEventListener *mPopupEventListener; + PRBool mInitialized; nsresult GetListener (void); nsresult AttachListeners (void); -- cgit v1.2.3