[evince] pdf: Always use poppler_document_save to avoid data loss
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] pdf: Always use poppler_document_save to avoid data loss
- Date: Thu, 5 Oct 2017 17:55:15 +0000 (UTC)
commit 26dc2f52d002238323e4635672a1ee313b4a7bc6
Author: Germán Poo-Caamaño <gpoo gnome org>
Date: Tue Oct 3 08:59:30 2017 -0300
pdf: Always use poppler_document_save to avoid data loss
We used to use two methods to save a document: poppler_document_save
and poppler_document_save_a_copy. The latter only saves a copy of
the original document, discarding any change done (e.g. forms and
annotations). However, after a document has been modified and saved,
if there is no new change and the user saves the document, it will
discard even the previous saved changes to preserve a copy of the
original document.
By only using poppler_document_save to save the content of the
current document opened in Evince, to avoid data loss made between
saves.
https://bugzilla.gnome.org/show_bug.cgi?id=770012
backend/pdf/ev-poppler.cc | 20 +++++++-------------
1 files changed, 7 insertions(+), 13 deletions(-)
---
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index 1b18ce1..dc726c9 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -250,22 +250,16 @@ pdf_document_save (EvDocument *document,
gboolean retval;
GError *poppler_error = NULL;
- if (pdf_document->forms_modified || pdf_document->annots_modified) {
- retval = poppler_document_save (pdf_document->document,
- uri, &poppler_error);
- if (retval) {
- pdf_document->forms_modified = FALSE;
- pdf_document->annots_modified = FALSE;
- }
+ retval = poppler_document_save (pdf_document->document,
+ uri, &poppler_error);
+ if (retval) {
+ pdf_document->forms_modified = FALSE;
+ pdf_document->annots_modified = FALSE;
+ ev_document_set_modified (EV_DOCUMENT (document), FALSE);
} else {
- retval = poppler_document_save_a_copy (pdf_document->document,
- uri, &poppler_error);
- }
-
- if (! retval)
convert_error (poppler_error, error);
+ }
- ev_document_set_modified (EV_DOCUMENT (document), FALSE);
return retval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]