diff options
author | Christian Persch <chpe@src.gnome.org> | 2009-02-15 13:53:34 (GMT) |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2009-02-15 13:53:34 (GMT) |
commit | 3902bcf1103b559bf918b132aa9d84e680a062cc (patch) | |
tree | d563a2bcb1b62f582fbb3b7fae04aa513a8df6e4 | |
parent | 643fcd30fb4848b599bb690caaef144a09ecfe85 (diff) |
Add code to catch backends incorrectly implementing the load vfunc.
* libdocument/ev-document.c: (ev_document_load): Add code to catch
backends incorrectly implementing the load vfunc.
svn path=/trunk/; revision=3460
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | libdocument/ev-document.c | 19 |
2 files changed, 22 insertions, 2 deletions
@@ -1,5 +1,10 @@ 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: (ev_document_factory_get_document): Use a local GError, and propagate as appropriate, making sure always to fill in @error if returning NULL. diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c index 3356dc2..b230b70 100644 --- a/libdocument/ev-document.c +++ b/libdocument/ev-document.c @@ -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; } |