evince r3460 - in trunk: . libdocument



Author: chpe
Date: Sun Feb 15 13:53:34 2009
New Revision: 3460
URL: http://svn.gnome.org/viewvc/evince?rev=3460&view=rev

Log:
	* libdocument/ev-document.c: (ev_document_load): Add code to catch
	backends incorrectly implementing the load vfunc.

Modified:
   trunk/ChangeLog
   trunk/libdocument/ev-document.c

Modified: trunk/libdocument/ev-document.c
==============================================================================
--- trunk/libdocument/ev-document.c	(original)
+++ trunk/libdocument/ev-document.c	Sun Feb 15 13:53:34 2009
@@ -120,8 +120,23 @@
 {
 	EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
 	gboolean retval;
+	GError *err = NULL;
 
-	retval = iface->load (document, uri, error);
+	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;
 }



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