[file-roller] do not crash if the introspection data is not loaded correctly



commit 123919e9fc55b468af1a52cc4384441c7fcb119a
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Oct 16 19:57:19 2012 +0200

    do not crash if the introspection data is not loaded correctly

 src/main.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 2ecd316..e935311 100644
--- a/src/main.c
+++ b/src/main.c
@@ -600,6 +600,7 @@ fr_application_register_archive_manager_service (FrApplication *self)
 	gsize         size;
 	guchar       *buffer;
 	GInputStream *stream;
+	GError       *error = NULL;
 
 	g_application_hold (G_APPLICATION (self));
 
@@ -608,15 +609,21 @@ fr_application_register_archive_manager_service (FrApplication *self)
 	stream = g_resources_open_stream (ORG_GNOME_ARCHIVEMANAGER_XML, 0, NULL);
 	g_input_stream_read_all (stream, buffer, size, NULL, NULL, NULL);
 
-	self->introspection_data = g_dbus_node_info_new_for_xml ((gchar *) buffer, NULL);
-	self->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
-					 "org.gnome.ArchiveManager1",
-					 G_BUS_NAME_OWNER_FLAGS_NONE,
-					 on_bus_acquired_for_archive_manager,
-					 NULL /*on_name_acquired*/,
-					 NULL /*on_name_lost*/,
-					 self,
-					 NULL);
+	self->introspection_data = g_dbus_node_info_new_for_xml ((gchar *) buffer, &error);
+	if (self->introspection_data != NULL) {
+		self->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
+						 "org.gnome.ArchiveManager1",
+						 G_BUS_NAME_OWNER_FLAGS_NONE,
+						 on_bus_acquired_for_archive_manager,
+						 NULL /*on_name_acquired*/,
+						 NULL /*on_name_lost*/,
+						 self,
+						 NULL);
+	}
+	else {
+		g_warning ("%s", error->message);
+		g_clear_error (&error);
+	}
 
 	g_timeout_add_seconds (SERVICE_TIMEOUT, service_timeout_cb, self);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]