[tracker] libtracker-miner, miner-fs, extract: Don't assume g_dbus_info_new_for_xml() never fails
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-miner, miner-fs, extract: Don't assume g_dbus_info_new_for_xml() never fails
- Date: Tue, 15 Mar 2011 17:11:40 +0000 (UTC)
commit 645c8eabef1fa62caf0f8d790522d78d646e4831
Author: Aleksander Morgado <aleksander lanedo com>
Date: Tue Mar 15 17:40:53 2011 +0100
libtracker-miner,miner-fs,extract: Don't assume g_dbus_info_new_for_xml() never fails
Not a big deal because the introspection XML is hardcoded and thus shouldn't
break g_dbus_info_new_for_xml(), but anyway, better get an error message than
a segfault if the xml is ever broken...
src/libtracker-miner/tracker-miner-object.c | 6 +++++-
src/libtracker-miner/tracker-miner-web.c | 6 +++++-
src/miners/fs/tracker-miner-files-index.c | 8 +++++++-
src/tracker-extract/tracker-extract.c | 9 +++++++--
4 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-object.c b/src/libtracker-miner/tracker-miner-object.c
index 7d03dc6..9331fc2 100644
--- a/src/libtracker-miner/tracker-miner-object.c
+++ b/src/libtracker-miner/tracker-miner-object.c
@@ -381,7 +381,11 @@ miner_initable_init (GInitable *initable,
}
/* Setup introspection data */
- miner->private->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
+ miner->private->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, &inner_error);
+ if (!miner->private->introspection_data) {
+ g_propagate_error (error, inner_error);
+ return FALSE;
+ }
/* Check miner has a proper name */
if (!miner->private->name) {
diff --git a/src/libtracker-miner/tracker-miner-web.c b/src/libtracker-miner/tracker-miner-web.c
index 7da7632..989aee0 100644
--- a/src/libtracker-miner/tracker-miner-web.c
+++ b/src/libtracker-miner/tracker-miner-web.c
@@ -164,7 +164,11 @@ miner_web_initable_init (GInitable *initable,
}
/* Setup web-interface introspection data */
- mw->private->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
+ mw->private->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, &inner_error);
+ if (!mw->private->introspection_data) {
+ g_propagate_error (error, inner_error);
+ return FALSE;
+ }
g_message ("Registering Web interface in D-Bus object...");
g_message (" Path:'%s'", tracker_miner_get_dbus_full_path (miner));
diff --git a/src/miners/fs/tracker-miner-files-index.c b/src/miners/fs/tracker-miner-files-index.c
index d2c7cc5..6387d4f 100644
--- a/src/miners/fs/tracker-miner-files-index.c
+++ b/src/miners/fs/tracker-miner-files-index.c
@@ -544,7 +544,13 @@ tracker_miner_files_index_new (TrackerMinerFiles *miner_files)
return NULL;
}
- priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
+ priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, &error);
+ if (!priv->introspection_data) {
+ g_critical ("Could not create node info from introspection XML, %s",
+ error ? error->message : "no error given.");
+ g_clear_error (&error);
+ return NULL;
+ }
full_name = g_strconcat (TRACKER_MINER_DBUS_NAME_PREFIX, "Files.Index", NULL);
priv->full_name = full_name;
diff --git a/src/tracker-extract/tracker-extract.c b/src/tracker-extract/tracker-extract.c
index bc0882e..0d7d2b5 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -727,7 +727,6 @@ tracker_extract_dbus_start (TrackerExtract *extract)
priv = TRACKER_EXTRACT_GET_PRIVATE (extract);
priv->d_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
-
if (!priv->d_connection) {
g_critical ("Could not connect to the D-Bus session bus, %s",
error ? error->message : "no error given.");
@@ -735,7 +734,13 @@ tracker_extract_dbus_start (TrackerExtract *extract)
return;
}
- priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
+ priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, &error);
+ if (!priv->introspection_data) {
+ g_critical ("Could not create node info from introspection XML, %s",
+ error ? error->message : "no error given.");
+ g_clear_error (&error);
+ return;
+ }
g_message ("Registering D-Bus object...");
g_message (" Path:'" TRACKER_EXTRACT_PATH "'");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]