aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-06-13 09:45:52 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-06-13 09:45:52 +0800
commit09d01be0aae3b356c892d56d2c5f8eb5ae27a8d2 (patch)
tree59d278d8c553d4a5835b7a52631408d45e109380
parent509a845d41fe6fbe3a689ee9827bdd205160fd41 (diff)
downloadgsoc2013-evolution-09d01be0aae3b356c892d56d2c5f8eb5ae27a8d2.tar.gz
gsoc2013-evolution-09d01be0aae3b356c892d56d2c5f8eb5ae27a8d2.tar.zst
gsoc2013-evolution-09d01be0aae3b356c892d56d2c5f8eb5ae27a8d2.zip
Bug 585554 – Opening PDF attachment crashes in e_attachment_open_handle_error()
-rw-r--r--widgets/misc/e-attachment.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index ba2811d5d9..7735be8872 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -1957,7 +1957,6 @@ attachment_open_file (GFile *file,
{
GdkAppLaunchContext *context;
GSimpleAsyncResult *simple;
- GList *file_list;
gboolean success;
GError *error = NULL;
@@ -1965,41 +1964,29 @@ attachment_open_file (GFile *file,
simple = open_context->simple;
open_context->simple = NULL;
- /* Find a default app based on content type. */
- if (open_context->app_info == NULL) {
- EAttachment *attachment;
- GFileInfo *file_info;
- const gchar *content_type;
-
- attachment = open_context->attachment;
- file_info = e_attachment_get_file_info (attachment);
- if (file_info == NULL)
- goto exit;
-
- content_type = g_file_info_get_content_type (file_info);
- if (content_type == NULL)
- goto exit;
+ context = gdk_app_launch_context_new ();
- open_context->app_info = g_app_info_get_default_for_type (
- content_type, FALSE);
+ if (open_context->app_info != NULL) {
+ GList *file_list;
+
+ file_list = g_list_prepend (NULL, file);
+ success = g_app_info_launch (
+ open_context->app_info, file_list,
+ G_APP_LAUNCH_CONTEXT (context), &error);
+ g_list_free (file_list);
+ } else {
+ gchar *uri;
+
+ uri = g_file_get_uri (file);
+ success = g_app_info_launch_default_for_uri (
+ uri, G_APP_LAUNCH_CONTEXT (context), &error);
+ g_free (uri);
}
- if (open_context->app_info == NULL)
- goto exit;
-
- context = gdk_app_launch_context_new ();
- file_list = g_list_prepend (NULL, file);
-
- success = g_app_info_launch (
- open_context->app_info, file_list,
- G_APP_LAUNCH_CONTEXT (context), &error);
+ g_object_unref (context);
g_simple_async_result_set_op_res_gboolean (simple, success);
- g_list_free (file_list);
- g_object_unref (context);
-
-exit:
if (error != NULL) {
g_simple_async_result_set_from_error (simple, error);
g_error_free (error);