[gtk+] GtkAppChooser: Deal with 'no app found' gracefully
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkAppChooser: Deal with 'no app found' gracefully
- Date: Mon, 29 Aug 2011 02:47:25 +0000 (UTC)
commit 6d797d5356cf7af445befb846e260b92e6cece2c
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Aug 28 22:43:20 2011 -0400
GtkAppChooser: Deal with 'no app found' gracefully
Several functions inside GtkAppChooserDialog were not handling
the situation that app_info might be NULL after the user clicked
'Select'.
https://bugzilla.gnome.org/show_bug.cgi?id=651827
gtk/gtkappchooserdialog.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkappchooserdialog.c b/gtk/gtkappchooserdialog.c
index 5f0de03..178d291 100644
--- a/gtk/gtkappchooserdialog.c
+++ b/gtk/gtkappchooserdialog.c
@@ -212,6 +212,12 @@ check_application (GtkAppChooserDialog *self,
command = NULL;
info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self->priv->app_chooser_widget));
+ if (info == NULL)
+ {
+ *app_out = NULL;
+ return FALSE;
+ }
+
command = g_app_info_get_executable (info);
g_shell_parse_argv (command, &argc, &argv, &error);
@@ -258,13 +264,15 @@ add_or_find_application (GtkAppChooserDialog *self)
app = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self));
- /* we don't care about reporting errors here */
- if (self->priv->content_type)
- g_app_info_set_as_last_used_for_type (app,
- self->priv->content_type,
- NULL);
-
- g_object_unref (app);
+ if (app)
+ {
+ /* we don't care about reporting errors here */
+ if (self->priv->content_type)
+ g_app_info_set_as_last_used_for_type (app,
+ self->priv->content_type,
+ NULL);
+ g_object_unref (app);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]