summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorGermán Poo-Caamaño <[email protected]>2017-10-03 08:59:30 -0300
committerVictor Kareh <[email protected]>2026-03-11 14:58:19 -0400
commitd83ac7788e1ee6375a646269e9e83019164aef81 (patch)
treeb616a0960d280f7c36900280977e339fb809bfcc /backend
parent8083632def77040322419538db09617d509d1cfc (diff)
downloadatril-master.tar.bz2
atril-master.tar.xz
pdf: Always use poppler_document_save to avoid data lossHEADmaster
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 Atril, to avoid data loss made between saves. https://bugzilla.gnome.org/show_bug.cgi?id=770012 Adapted from the original commit at: https://gitlab.gnome.org/GNOME/evince/-/commit/26dc2f52 Co-authored-by: Eric Park <[email protected]>
Diffstat (limited to 'backend')
-rw-r--r--backend/pdf/ev-poppler.cc18
1 files changed, 6 insertions, 12 deletions
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index 32005dd8..ef3b06a8 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -251,20 +251,14 @@ 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;
} else {
- retval = poppler_document_save_a_copy (pdf_document->document,
- uri, &poppler_error);
- }
-
- if (! retval)
convert_error (poppler_error, error);
+ }
return retval;
}