[Xfce4-commits] [xfce/xfce4-settings] 01/02: Fork before gtk/dbus init (bug #11045)
noreply at xfce.org
noreply at xfce.org
Mon Jul 28 17:23:38 CEST 2014
This is an automated email from the git hooks/post-receive script.
ochosi pushed a commit to branch master
in repository xfce/xfce4-settings.
commit 791f02416560f5ac75250a9a67f4e2a3d0ac6f7c
Author: Eric Koegel <eric.koegel at gmail.com>
Date: Mon Jul 28 09:03:30 2014 +0300
Fork before gtk/dbus init (bug #11045)
https://mail.xfce.org/pipermail/xfce4-dev/2014-May/030715.html
has the rational for the change.
---
xfsettingsd/main.c | 44 +++++++++++++++++++++++++++++++-------------
1 file changed, 31 insertions(+), 13 deletions(-)
diff --git a/xfsettingsd/main.c b/xfsettingsd/main.c
index 55c4183..063d4a2 100644
--- a/xfsettingsd/main.c
+++ b/xfsettingsd/main.c
@@ -175,11 +175,12 @@ main (gint argc, gchar **argv)
context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, option_entries, GETTEXT_PACKAGE);
- g_option_context_add_group (context, gtk_get_option_group (FALSE));
+ /* We can't add the following command because it will invoke gtk_init
+ before we have a chance to fork.
+ g_option_context_add_group (context, gtk_get_option_group (FALSE));
+ */
g_option_context_add_group (context, xfce_sm_client_get_option_group (argc, argv));
- gtk_init (&argc, &argv);
-
/* parse options */
if (!g_option_context_parse (context, &argc, &argv, &error))
{
@@ -207,6 +208,33 @@ main (gint argc, gchar **argv)
return EXIT_SUCCESS;
}
+ /* daemonize the process */
+ if (!opt_no_daemon)
+ {
+ if (daemonize () == -1)
+ {
+ /* show message and continue in normal mode */
+ g_warning ("Failed to fork the process: %s. Continuing in non-daemon mode.", g_strerror (errno));
+ }
+ }
+
+ if (!gtk_init_check (&argc, &argv))
+ {
+ if (G_LIKELY (error))
+ {
+ g_printerr ("%s: %s.\n", G_LOG_DOMAIN, error->message);
+ g_printerr (_("Type '%s --help' for usage."), G_LOG_DOMAIN);
+ g_printerr ("\n");
+ g_error_free (error);
+ }
+ else
+ {
+ g_error ("Unable to open display.");
+ }
+
+ return EXIT_FAILURE;
+ }
+
dbus_connection = dbus_bus_get (DBUS_BUS_SESSION, NULL);
if (G_LIKELY (dbus_connection != NULL))
{
@@ -254,16 +282,6 @@ main (gint argc, gchar **argv)
g_clear_error (&error);
}
- /* daemonize the process */
- if (!opt_no_daemon)
- {
- if (daemonize () == -1)
- {
- /* show message and continue in normal mode */
- g_warning ("Failed to fork the process: %s. Continuing in non-daemon mode.", g_strerror (errno));
- }
- }
-
/* launch settings manager */
xsettings_helper = g_object_new (XFCE_TYPE_XSETTINGS_HELPER, NULL);
xfce_xsettings_helper_register (XFCE_XSETTINGS_HELPER (xsettings_helper),
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list