aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-06-11 05:21:36 +0800
committerChristian Persch <chpe@src.gnome.org>2005-06-11 05:21:36 +0800
commit55bcddfd18577f6363842ad3b1772e0db9f1c011 (patch)
tree8d9902be38c7d2b19072106bac9a5f840acd2660 /embed/mozilla
parent525eb97bca09bc9a4abe3925f70c3fc5a485f3f7 (diff)
downloadgsoc2013-epiphany-55bcddfd18577f6363842ad3b1772e0db9f1c011.tar
gsoc2013-epiphany-55bcddfd18577f6363842ad3b1772e0db9f1c011.tar.gz
gsoc2013-epiphany-55bcddfd18577f6363842ad3b1772e0db9f1c011.tar.bz2
gsoc2013-epiphany-55bcddfd18577f6363842ad3b1772e0db9f1c011.tar.lz
gsoc2013-epiphany-55bcddfd18577f6363842ad3b1772e0db9f1c011.tar.xz
gsoc2013-epiphany-55bcddfd18577f6363842ad3b1772e0db9f1c011.tar.zst
gsoc2013-epiphany-55bcddfd18577f6363842ad3b1772e0db9f1c011.zip
Common helper function to unref a GObject from idle.
2005-06-10 Christian Persch <chpe@cvs.gnome.org> * lib/Makefile.am: * lib/ephy-object-helpers.c: * lib/ephy-object-helpers.h: Common helper function to unref a GObject from idle. * embed/downloader-view.c: (downloader_view_finalize): * embed/mozilla/mozilla-embed-find.cpp: * embed/mozilla/mozilla-embed-persist.cpp: * embed/mozilla/mozilla-embed.cpp: * src/ephy-extensions-manager.c: (unload_extension): * src/ephy-main.c: (main): * src/ephy-shell.c: (toolwindow_hide_cb): * src/ephy-window.c: (ephy_window_finalize): Always unref the shell from idle, never directly. That's because in case we hold the last reference, we would end up terminating embedding/XPCOM from a mozilla callback. Fixes bug #151037, and moz#236688.
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/mozilla-embed-find.cpp5
-rw-r--r--embed/mozilla/mozilla-embed-persist.cpp7
-rw-r--r--embed/mozilla/mozilla-embed.cpp10
3 files changed, 20 insertions, 2 deletions
diff --git a/embed/mozilla/mozilla-embed-find.cpp b/embed/mozilla/mozilla-embed-find.cpp
index d589630b5..92e755e2b 100644
--- a/embed/mozilla/mozilla-embed-find.cpp
+++ b/embed/mozilla/mozilla-embed-find.cpp
@@ -28,6 +28,8 @@
#include "mozilla-embed-find.h"
#include "ephy-embed-find.h"
#include "ephy-embed-shell.h"
+#include "ephy-object-helpers.h"
+#include "ephy-debug.h"
#define MOZILLA_EMBED_FIND_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MOZILLA_TYPE_EMBED_FIND, MozillaEmbedFindPrivate))
@@ -103,6 +105,7 @@ mozilla_embed_find_constructor (GType type, guint n_construct_properties,
GObjectConstructParam *construct_params)
{
g_object_ref (embed_shell);
+
/* we depend on single because of mozilla initialization */
ephy_embed_shell_get_embed_single (embed_shell);
@@ -119,7 +122,7 @@ mozilla_embed_find_finalize (GObject *object)
parent_class->finalize (object);
- g_object_unref (embed_shell);
+ ephy_object_idle_unref (embed_shell);
}
static void
diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp
index c10d677ae..b84fdfe59 100644
--- a/embed/mozilla/mozilla-embed-persist.cpp
+++ b/embed/mozilla/mozilla-embed-persist.cpp
@@ -26,6 +26,7 @@
#include "mozilla-embed.h"
#include "ephy-embed-shell.h"
#include "ephy-file-helpers.h"
+#include "ephy-object-helpers.h"
#include "EphyBrowser.h"
#include "EphyHeaderSniffer.h"
#include "MozDownload.h"
@@ -102,6 +103,8 @@ mozilla_embed_persist_finalize (GObject *object)
persist->priv->mPersist = nsnull;
G_OBJECT_CLASS (parent_class)->finalize (object);
+
+ ephy_object_idle_unref (embed_shell);
}
void
@@ -339,7 +342,9 @@ static GObject *
mozilla_embed_persist_constructor (GType type, guint n_construct_properties,
GObjectConstructParam *construct_params)
{
- /* we depend on single because of mozilla initialization */
+ g_object_ref (embed_shell);
+
+ /* this will ensure that mozilla is started up */
ephy_embed_shell_get_embed_single (embed_shell);
return parent_class->constructor (type, n_construct_properties,
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 8a9d3aadc..1b7733e0d 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -29,6 +29,7 @@
#include "ephy-embed-shell.h"
#include "ephy-command-manager.h"
#include "ephy-string.h"
+#include "ephy-object-helpers.h"
#include "ephy-debug.h"
#include "EphyBrowser.h"
@@ -201,6 +202,8 @@ static GObject *
mozilla_embed_constructor (GType type, guint n_construct_properties,
GObjectConstructParam *construct_params)
{
+ g_object_ref (embed_shell);
+
/* we depend on single because of mozilla initialization */
ephy_embed_shell_get_embed_single (embed_shell);
@@ -289,6 +292,8 @@ mozilla_embed_finalize (GObject *object)
}
G_OBJECT_CLASS (parent_class)->finalize (object);
+
+ ephy_object_idle_unref (embed_shell);
}
static void
@@ -1127,6 +1132,8 @@ _mozilla_embed_new_xul_dialog (void)
{
GtkWidget *window, *embed;
+ g_object_ref (embed_shell);
+
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
embed = gtk_moz_embed_new ();
gtk_widget_show (embed);
@@ -1148,5 +1155,8 @@ _mozilla_embed_new_xul_dialog (void)
G_CALLBACK (xul_title_cb),
window, (GConnectFlags) 0);
+ g_object_weak_ref (G_OBJECT (window),
+ (GWeakNotify) ephy_object_idle_unref, embed_shell);
+
return GTK_MOZ_EMBED (embed);
}