new functions add sigterm_handler in case we receive a SIGTERM. Closes
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. svn path=/trunk/; revision=3974
This commit is contained in:
parent
b7ee7bdd9b
commit
1866268c94
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
||||
2008-10-22 Matthew Martin <mtt.martin@gmail.com>
|
||||
|
||||
* src/core/window.c (meta_window_set_demands_attention): minimised
|
||||
|
@ -323,8 +323,8 @@ meta_parse_options (int *argc, char ***argv,
|
||||
* 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 @@ void meta_select_display (gchar *display_name)
|
||||
/* 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 @@ main (int argc, char **argv)
|
||||
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 @@ main (int argc, char **argv)
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user