aboutsummaryrefslogtreecommitdiff
path: root/libmessaging-menu
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2012-10-01 17:26:44 +0200
committerLars Uebernickel <lars.uebernickel@canonical.com>2012-10-01 17:26:44 +0200
commit7a1769409539c7d672af51106d0fa186b32bd0ea (patch)
tree0ffdbd06fef375ce76b4ac94d06e0e6701a46b3a /libmessaging-menu
parent81ed3b837344a7423c8e7d676d161be56a386d09 (diff)
downloadayatana-indicator-messages-7a1769409539c7d672af51106d0fa186b32bd0ea.tar.gz
ayatana-indicator-messages-7a1769409539c7d672af51106d0fa186b32bd0ea.tar.bz2
ayatana-indicator-messages-7a1769409539c7d672af51106d0fa186b32bd0ea.zip
libmessaging-menu: don't crash when getting an invalid desktop id
Instead, silently don't export menus and actions. The single warning about the desktop id being invalid should be enough.
Diffstat (limited to 'libmessaging-menu')
-rw-r--r--libmessaging-menu/messaging-menu.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/libmessaging-menu/messaging-menu.c b/libmessaging-menu/messaging-menu.c
index 8a95b0a..3c5c6d4 100644
--- a/libmessaging-menu/messaging-menu.c
+++ b/libmessaging-menu/messaging-menu.c
@@ -148,7 +148,8 @@ messaging_menu_app_get_dbus_object_path (MessagingMenuApp *app)
{
gchar *path;
- g_return_val_if_fail (app->appinfo != NULL, NULL);
+ if (!app->appinfo)
+ return NULL;
path = g_strconcat ("/com/canonical/indicator/messages/",
g_app_info_get_id (G_APP_INFO (app->appinfo)),
@@ -170,6 +171,10 @@ export_menus_and_actions (GObject *source,
guint id;
gchar *object_path;
+ object_path = messaging_menu_app_get_dbus_object_path (app);
+ if (!object_path)
+ return;
+
bus = g_bus_get_finish (res, &error);
if (bus == NULL)
{
@@ -178,8 +183,6 @@ export_menus_and_actions (GObject *source,
return;
}
- object_path = messaging_menu_app_get_dbus_object_path (app);
-
id = g_dbus_connection_export_action_group (bus,
object_path,
G_ACTION_GROUP (app->source_actions),
@@ -479,6 +482,8 @@ messaging_menu_app_register (MessagingMenuApp *app)
return;
object_path = messaging_menu_app_get_dbus_object_path (app);
+ if (!object_path)
+ return;
indicator_messages_service_call_register_application (app->messages_service,
g_app_info_get_id (G_APP_INFO (app->appinfo)),
@@ -510,6 +515,9 @@ messaging_menu_app_unregister (MessagingMenuApp *app)
if (!app->messages_service)
return;
+ if (!app->appinfo)
+ return;
+
indicator_messages_service_call_unregister_application (app->messages_service,
g_app_info_get_id (G_APP_INFO (app->appinfo)),
app->cancellable,
@@ -546,6 +554,9 @@ messaging_menu_app_set_status (MessagingMenuApp *app,
if (!app->messages_service)
return;
+ if (!app->appinfo)
+ return;
+
indicator_messages_service_call_set_status (app->messages_service,
g_app_info_get_id (G_APP_INFO (app->appinfo)),
status_ids [status],