summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2011-02-22 12:25:27 -0500
committerCosimo Cecchi <cosimoc@gnome.org>2011-02-22 12:25:27 -0500
commita0569367b029140ca15cdd5d0d78a3577c3d6d83 (patch)
tree65e3ebec1d8d2962b2d3486a8ff5eb99324a4dcf
parent8ff66dc5aeb7c573ef3deb6100fa151e9f9349e9 (diff)
downloadnautilus-a0569367b029140ca15cdd5d0d78a3577c3d6d83.tar.gz
module: make modules for extension that pull in ORBit resident
ORBit installs atexit() handlers, which would get unloaded together with the module now that the main process doesn't depend on GConf anymore, causing nautilus to sefgault at exit. If we detect that an extension would pull in ORBit, we make the module resident to prevent that.
-rw-r--r--libnautilus-private/nautilus-module.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libnautilus-private/nautilus-module.c b/libnautilus-private/nautilus-module.c
index 891d79ddb..cb76326c4 100644
--- a/libnautilus-private/nautilus-module.c
+++ b/libnautilus-private/nautilus-module.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
* nautilus-module.h - Interface to nautilus extensions
*
@@ -64,6 +65,17 @@ G_DEFINE_TYPE (NautilusModule, nautilus_module, G_TYPE_TYPE_MODULE);
#define parent_class nautilus_module_parent_class
static gboolean
+module_pulls_in_orbit (GModule *module)
+{
+ gpointer symbol;
+ gboolean res;
+
+ res = g_module_symbol (module, "ORBit_realloc_tcval", &symbol);
+
+ return res;
+}
+
+static gboolean
nautilus_module_load (GTypeModule *gmodule)
{
NautilusModule *module;
@@ -72,6 +84,16 @@ nautilus_module_load (GTypeModule *gmodule)
module->library = g_module_open (module->path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
+ /* ORBit installs atexit() handlers, which would get unloaded together
+ * with the module now that the main process doesn't depend on GConf anymore,
+ * causing nautilus to sefgault at exit.
+ * If we detect that an extension would pull in ORBit, we make the
+ * module resident to prevent that.
+ */
+ if (module_pulls_in_orbit (module->library)) {
+ g_module_make_resident (module->library);
+ }
+
if (!module->library) {
g_warning ("%s", g_module_error ());
return FALSE;