]> www.fi.muni.cz Git - evince.git/commitdiff
Add code to catch backends incorrectly implementing the load vfunc.
authorChristian Persch <chpe@src.gnome.org>
Sun, 15 Feb 2009 13:53:34 +0000 (13:53 +0000)
committerChristian Persch <chpe@src.gnome.org>
Sun, 15 Feb 2009 13:53:34 +0000 (13:53 +0000)
* libdocument/ev-document.c: (ev_document_load): Add code to catch
backends incorrectly implementing the load vfunc.

svn path=/trunk/; revision=3460

ChangeLog
libdocument/ev-document.c

index 1721e2fc5a024d335f4fcf2c162e69ff7576af0b..7b78906fd1759cb029323522b27e631086602b49 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-02-14  Christian Persch  <chpe@gnome.org>
+
+       * libdocument/ev-document.c: (ev_document_load): Add code to catch
+       backends incorrectly implementing the load vfunc.
+
 2009-02-14  Christian Persch  <chpe@gnome.org>
 
        * libdocument/ev-document-factory.c:
index 3356dc2e6fee364b1ff548df4ffcb1a53ebb32b5..b230b706cf6a08debba59884caee8e796fadb3e6 100644 (file)
@@ -120,8 +120,23 @@ ev_document_load (EvDocument  *document,
 {
        EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
        gboolean retval;
-
-       retval = iface->load (document, uri, error);
+       GError *err = NULL;
+
+       retval = iface->load (document, uri, &err);
+       if (!retval) {
+               if (err) {
+                       g_propagate_error (error, err);
+               } else {
+                       g_warning ("%s::EvDocumentIface::load returned FALSE but did not fill in @error; fix the backend!\n",
+                                  G_OBJECT_TYPE_NAME (document));
+
+                       /* So upper layers don't crash */
+                       g_set_error_literal (error,
+                                            EV_DOCUMENT_ERROR,
+                                            EV_DOCUMENT_ERROR_INVALID,
+                                            "Internal error in backend");
+               }
+       }
 
        return retval;
 }