Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/backend/ev-document-factory.c
diff options
context:
space:
mode:
authorNickolay V. Shmyrev <nshmyrev@yandex.ru>2006-08-17 07:20:47 (GMT)
committer Nickolay V. Shmyrev <nshmyrev@src.gnome.org>2006-08-17 07:20:47 (GMT)
commita554f8e3595152cd2afa33c6a2a368f6469509de (patch)
tree4c025eb7436a90d14678cde84fd24137a8eca310 /backend/ev-document-factory.c
parent484aa472475af8da26c9dcf302fe855c2f6f63b5 (diff)
More correct handling of document loading. Fixes bug #349043.
2006-08-17 Nickolay V. Shmyrev <nshmyrev@yandex.ru> * backend/ev-document-factory.c: (ev_document_factory_get_document): * tiff/tiff-document.c: (tiff_document_finalize): More correct handling of document loading. Fixes bug #349043.
Diffstat (limited to 'backend/ev-document-factory.c')
-rw-r--r--backend/ev-document-factory.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/backend/ev-document-factory.c b/backend/ev-document-factory.c
index 23364a2..278a21a 100644
--- a/backend/ev-document-factory.c
+++ b/backend/ev-document-factory.c
@@ -287,27 +287,48 @@ EvDocument *
ev_document_factory_get_document (const char *uri, GError **error)
{
EvDocument *document;
+ int result;
document = get_document_from_uri (uri, FALSE, error);
- if (*error == NULL) {
- ev_document_load (document, uri, error);
+ if (*error != NULL) {
+ return NULL;
}
+
+ result = ev_document_load (document, uri, error);
- if (*error) {
- g_error_free (*error);
- *error = NULL;
+ if (result == FALSE || *error) {
+ if (document)
+ g_object_unref (document);
+ document = NULL;
} else {
return document;
}
+ if (*error)
+ g_error_free (*error);
+ *error = NULL;
+
document = get_document_from_uri (uri, TRUE, error);
if (*error != NULL) {
return NULL;
}
- ev_document_load (document, uri, error);
+ result = ev_document_load (document, uri, error);
+
+ if (result == FALSE || *error) {
+ if (document)
+ g_object_unref (document);
+ document = NULL;
+ }
+
+ if (result == FALSE && *error == NULL) {
+ g_set_error (error,
+ EV_DOCUMENT_ERROR,
+ 0,
+ _("Unknown MIME Type"));
+ }
return document;
}