[gnome-software/gnome-3-14] details: Don't crash when launching an app that has no desktop ID
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-14] details: Don't crash when launching an app that has no desktop ID
- Date: Thu, 18 Jun 2015 13:52:02 +0000 (UTC)
commit 3e290f93ae8087046e0f4353527c3f1263ca3b4a
Author: Kalev Lember <kalevlember gmail com>
Date: Mon Jun 15 13:29:35 2015 +0200
details: Don't crash when launching an app that has no desktop ID
Be more defensive and avoid crashing when dealing with apps that have no
desktop ID associated. First, we make sure to hide the Launch button;
and second, just to be double sure, also check that the app ID is there
in the button's callback handler as well.
https://bugzilla.redhat.com/show_bug.cgi?id=1231697
src/gs-shell-details.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 80e6b5f..0d2ed48 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -709,6 +709,11 @@ gs_shell_details_refresh_all (GsShellDetails *shell_details)
break;
}
+ /* don't show the launch button if the app doesn't have a desktop ID */
+ tmp = gs_app_get_id (priv->app);
+ if (tmp == NULL)
+ gtk_widget_set_visible (priv->button_details_launch, FALSE);
+
/* make history button insensitive if there is none */
history = gs_app_get_history (priv->app);
switch (gs_app_get_id_kind (priv->app)) {
@@ -1269,12 +1274,16 @@ gs_shell_details_app_launch_button_cb (GtkWidget *widget, GsShellDetails *shell_
const gchar *desktop_id;
desktop_id = gs_app_get_id (shell_details->priv->app);
- display = gdk_display_get_default ();
+ if (desktop_id == NULL) {
+ g_warning ("no such desktop file: %s", desktop_id);
+ return;
+ }
appinfo = G_APP_INFO (g_desktop_app_info_new (desktop_id));
if (appinfo == NULL) {
g_warning ("no such desktop file: %s", desktop_id);
return;
}
+ display = gdk_display_get_default ();
context = G_APP_LAUNCH_CONTEXT (gdk_display_get_app_launch_context (display));
if (!g_app_info_launch (appinfo, NULL, context, &error)) {
g_warning ("launching %s failed: %s", desktop_id, error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]