[evince] shell: Check if doc implements Annotations interface before cast



commit 0f598615c155c8bfb12d28ba7565bb81756c0728
Author: José Aliste <jaliste src gnome org>
Date:   Thu Sep 25 16:58:12 2014 -0300

    shell: Check if doc implements Annotations interface before cast
    
    Without this check, evince will crash when a right-click
    on a non-pdf document is performed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=737197

 shell/ev-window.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index f9bf534..c4f1f5d 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -5028,7 +5028,7 @@ view_menu_annot_popup (EvWindow     *ev_window,
        GAction *action;
        gboolean show_annot_props = FALSE;
        gboolean show_attachment = FALSE;
-       gboolean can_remove_annots;
+       gboolean can_remove_annots = FALSE;
 
        g_clear_object (&ev_window->priv->annot);
        if (annot) {
@@ -5052,7 +5052,8 @@ view_menu_annot_popup (EvWindow     *ev_window,
                }
        }
 
-       can_remove_annots = ev_document_annotations_can_remove_annotation (EV_DOCUMENT_ANNOTATIONS 
(ev_window->priv->document));
+       if (EV_IS_DOCUMENT_ANNOTATIONS (ev_window->priv->document))
+               can_remove_annots = ev_document_annotations_can_remove_annotation (EV_DOCUMENT_ANNOTATIONS 
(ev_window->priv->document));
 
        action = g_action_map_lookup_action (G_ACTION_MAP (ev_window), "annot-properties");
        g_simple_action_set_enabled (G_SIMPLE_ACTION (action), show_annot_props);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]