From 475bbe2a78a4523752afad34d5b951903c3b3e35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Aliste?= Date: Thu, 25 Sep 2014 16:58:12 -0300 Subject: 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 origin commit: https://git.gnome.org/browse/evince/commit/?id=0f59861 --- shell/ev-window.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/ev-window.c b/shell/ev-window.c index ecdc86bf..b33637bd 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -5361,7 +5361,8 @@ view_menu_annot_popup (EvWindow *ev_window, { GtkAction *action; gboolean show_annot = FALSE; - gboolean can_remove_annots; + gboolean can_remove_annots = FALSE; + if (ev_window->priv->document->iswebdocument == TRUE ) return ; if (ev_window->priv->annot) g_object_unref (ev_window->priv->annot); @@ -5371,7 +5372,8 @@ view_menu_annot_popup (EvWindow *ev_window, "AnnotProperties"); gtk_action_set_visible (action, (annot != NULL && EV_IS_ANNOTATION_MARKUP (annot))); - 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 = gtk_action_group_get_action (ev_window->priv->view_popup_action_group, "RemoveAnnot"); -- cgit v1.2.1