metacity r3974 - in trunk: . src/core
- From: tthurman svn gnome org
- To: svn-commits-list gnome org
- Subject: metacity r3974 - in trunk: . src/core
- Date: Wed, 22 Oct 2008 03:35:49 +0000 (UTC)
Author: tthurman
Date: Wed Oct 22 03:35:48 2008
New Revision: 3974
URL: http://svn.gnome.org/viewvc/metacity?rev=3974&view=rev
Log:
2008-10-22 Joe Marcus Clarke <marcus freebsd org>
* src/core/main.c (meta_finalize, sigterm_handler): new functions
* src/core/main.c (main): add sigterm_handler in case we receive
a SIGTERM. Closes #553980.
Modified:
trunk/ChangeLog
trunk/src/core/main.c
Modified: trunk/src/core/main.c
==============================================================================
--- trunk/src/core/main.c (original)
+++ trunk/src/core/main.c Wed Oct 22 03:35:48 2008
@@ -323,8 +323,8 @@
* try to use the environment variable METACITY_DISPLAY. If that
* also is NULL, use the default - :0.0
*/
-static
-void meta_select_display (gchar *display_name)
+static void
+meta_select_display (gchar *display_name)
{
gchar *envVar = "";
if (display_name)
@@ -335,6 +335,23 @@
/* DO NOT FREE envVar, putenv() sucks */
putenv (envVar);
}
+
+static void
+meta_finalize (void)
+{
+ meta_display_close (meta_get_display (),
+ CurrentTime); /* I doubt correct timestamps matter here */
+
+ meta_session_shutdown ();
+}
+
+static void
+sigterm_handler (int signum)
+{
+ meta_finalize ();
+
+ exit (meta_exit_code);
+}
/**
* This is where the story begins. It parses commandline options and
@@ -375,6 +392,11 @@
g_strerror (errno));
#endif
+ act.sa_handler = &sigterm_handler;
+ if (sigaction (SIGTERM, &act, NULL) < 0)
+ g_printerr ("Failed to register SIGTERM handler: %s\n",
+ g_strerror (errno));
+
if (g_getenv ("METACITY_VERBOSE"))
meta_set_verbose (TRUE);
if (g_getenv ("METACITY_DEBUG"))
@@ -504,11 +526,8 @@
g_main_loop_run (meta_main_loop);
- meta_display_close (meta_get_display (),
- CurrentTime); /* I doubt correct timestamps matter here */
+ meta_finalize ();
- meta_session_shutdown ();
-
if (meta_restart_after_quit)
{
GError *err;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]