Fix a typo in registration of an object on DBus

Fixes #747318.
This commit is contained in:
Marek Kasik 2011-10-25 12:10:57 +02:00
parent 3891bb02c3
commit 85f82b21e6
2 changed files with 99 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Name: gnome-settings-daemon
Version: 3.2.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
Group: System Environment/Daemons
@ -9,6 +9,7 @@ URL: http://download.gnome.org/sources/%{name}
#VCS: git:git://git.gnome.org/gnome-settings-daemon
Source: http://download.gnome.org/sources/%{name}/3.1/%{name}-%{version}.tar.xz
Patch0: gsd-calculator.patch
Patch1: gsd-printer-object-registration.patch
Requires(pre): GConf2 >= 2.14
Requires(preun): GConf2 >= 2.14
@ -60,6 +61,7 @@ developing applications that use %{name}.
%prep
%setup -q
%patch0 -p1
%patch1 -p1 -b .gsd-printer
# autoreconf -i -f
@ -215,6 +217,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_datadir}/gnome-settings-daemon-3.0/input-device-example.sh
%changelog
* Tue Oct 25 2011 Marek Kasik <mkasik@redhat.com> - 3.2.1-3
- Fix a typo in registration of an object on DBus (#747318)
* Mon Oct 24 2011 Matthias Clasen <mclasen@redhat.com> - 3.2.1-2
- Fix calculator keybinding (#745367)

View File

@ -0,0 +1,93 @@
diff --git a/plugins/print-notifications/gsd-printer.c b/plugins/print-notifications/gsd-printer.c
index c1c2235..63481e1 100644
--- a/plugins/print-notifications/gsd-printer.c
+++ b/plugins/print-notifications/gsd-printer.c
@@ -1140,14 +1140,20 @@ on_npn_bus_acquired (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
+ GError *error = NULL;
+
npn_registration_id = g_dbus_connection_register_object (connection,
SCP_DBUS_NPN_PATH,
npn_introspection_data->interfaces[0],
&interface_vtable,
NULL,
NULL,
- NULL);
- g_assert (npn_registration_id > 0);
+ &error);
+
+ if (npn_registration_id == 0) {
+ g_warning ("Failed to register object: %s\n", error->message);
+ g_error_free (error);
+ }
}
static void
@@ -1155,14 +1161,20 @@ on_pdi_bus_acquired (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
{
+ GError *error = NULL;
+
pdi_registration_id = g_dbus_connection_register_object (connection,
SCP_DBUS_PDI_PATH,
- npn_introspection_data->interfaces[0],
+ pdi_introspection_data->interfaces[0],
&interface_vtable,
NULL,
NULL,
- NULL);
- g_assert (npn_registration_id > 0);
+ &error);
+
+ if (pdi_registration_id == 0) {
+ g_warning ("Failed to register object: %s\n", error->message);
+ g_error_free (error);
+ }
}
static void
@@ -1351,12 +1363,22 @@ main (int argc, char *argv[])
notify_init ("gnome-settings-daemon-printer");
npn_introspection_data =
- g_dbus_node_info_new_for_xml (npn_introspection_xml, NULL);
- g_assert (npn_introspection_data != NULL);
+ g_dbus_node_info_new_for_xml (npn_introspection_xml, &error);
+
+ if (npn_introspection_data == NULL) {
+ g_warning ("Error parsing introspection XML: %s\n", error->message);
+ g_error_free (error);
+ goto error;
+ }
pdi_introspection_data =
- g_dbus_node_info_new_for_xml (pdi_introspection_xml, NULL);
- g_assert (pdi_introspection_data != NULL);
+ g_dbus_node_info_new_for_xml (pdi_introspection_xml, &error);
+
+ if (pdi_introspection_data == NULL) {
+ g_warning ("Error parsing introspection XML: %s\n", error->message);
+ g_error_free (error);
+ goto error;
+ }
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
@@ -1426,4 +1448,14 @@ main (int argc, char *argv[])
g_dbus_node_info_unref (pdi_introspection_data);
return 0;
+
+error:
+
+ if (npn_introspection_data)
+ g_dbus_node_info_unref (npn_introspection_data);
+
+ if (pdi_introspection_data)
+ g_dbus_node_info_unref (pdi_introspection_data);
+
+ return 1;
}