[gnome-shell] Change 'debugexit' to quit main loop rather than exit(), add cleanup
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Change 'debugexit' to quit main loop rather than exit(), add cleanup
- Date: Thu, 19 May 2011 19:37:11 +0000 (UTC)
commit a8baf4a2a2211a0df19e321780678236aaffe477
Author: Colin Walters <walters verbum org>
Date: Thu May 5 18:09:59 2011 -0400
Change 'debugexit' to quit main loop rather than exit(), add cleanup
A new envrionment variable GNOME_SHELL_ENABLE_CLEANUP is added which
causes us to attempt freeing global data. The reason this isn't
enabled by default is that it's a waste of time at best, and at
worst in corner cases could cause crashes which would fill up
crash databases. Better to leave it as a developer-only tool.
Start stubbing out some cleanup in ShellGlobal.
https://bugzilla.gnome.org/show_bug.cgi?id=649517
js/ui/runDialog.js | 2 +-
src/main.c | 11 ++++++++++-
src/shell-global.c | 19 +++++++++++++++++--
3 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index 3114bd8..192a93a 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -189,7 +189,7 @@ __proto__: ModalDialog.ModalDialog.prototype,
}),
'debugexit': Lang.bind(this, function() {
- Meta.exit(Meta.ExitCode.ERROR);
+ Meta.quit(Meta.ExitCode.ERROR);
}),
// rt is short for "reload theme"
diff --git a/src/main.c b/src/main.c
index c9c9d6e..0e77187 100644
--- a/src/main.c
+++ b/src/main.c
@@ -453,6 +453,7 @@ main (int argc, char **argv)
{
GOptionContext *ctx;
GError *error = NULL;
+ int ecode;
g_type_init ();
@@ -507,5 +508,13 @@ main (int argc, char **argv)
/* Initialize the global object */
shell_global_get ();
- return meta_run ();
+ ecode = meta_run ();
+
+ if (g_getenv ("GNOME_SHELL_ENABLE_CLEANUP"))
+ {
+ g_printerr ("Doing final cleanup...\n");
+ g_object_unref (shell_global_get ());
+ }
+
+ return ecode;
}
diff --git a/src/shell-global.c b/src/shell-global.c
index 9cb2c50..e18dbc9 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -34,6 +34,8 @@
#include "shell-wm.h"
#include "st.h"
+static ShellGlobal *the_object = NULL;
+
static void grab_notify (GtkWidget *widget, gboolean is_grab, gpointer user_data);
struct _ShellGlobal {
@@ -255,12 +257,27 @@ shell_global_init (ShellGlobal *global)
}
static void
+shell_global_finalize (GObject *object)
+{
+ ShellGlobal *global = SHELL_GLOBAL (object);
+
+ g_object_unref (global->js_context);
+ gtk_widget_destroy (GTK_WIDGET (global->grab_notifier));
+ g_object_unref (global->settings);
+
+ the_object = NULL;
+
+ G_OBJECT_CLASS(shell_global_parent_class)->finalize (object);
+}
+
+static void
shell_global_class_init (ShellGlobalClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = shell_global_get_property;
gobject_class->set_property = shell_global_set_property;
+ gobject_class->finalize = shell_global_finalize;
/* Emitted from gnome-shell-plugin.c during event handling */
shell_global_signals[XDND_POSITION_CHANGED] =
@@ -424,8 +441,6 @@ shell_global_class_init (ShellGlobalClass *klass)
ShellGlobal *
shell_global_get (void)
{
- static ShellGlobal *the_object = NULL;
-
if (!the_object)
the_object = g_object_new (SHELL_TYPE_GLOBAL, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]