From 482bd09d78ee5818c0cefa761ffacca53c25005e Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Mon, 18 Aug 2014 23:40:10 +0200 Subject: [PATCH] Avoid rewriting non-editable app settings This is a workaround, see TODO in code for details. --- src/linkapp.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/linkapp.cpp b/src/linkapp.cpp index cbbe82e..3d9e978 100644 --- a/src/linkapp.cpp +++ b/src/linkapp.cpp @@ -334,7 +334,12 @@ bool LinkApp::targetExists() } bool LinkApp::save() { - if (!edited) return true; + // TODO: In theory a non-editable Link wouldn't have 'edited' set, but + // currently 'edited' is set on more than a few non-edits, so this + // extra check helps prevent write attempts that will never succeed. + // Maybe we shouldn't have an 'edited' flag at all and make the + // outside world fully responsible for calling save() when needed. + if (!editable || !edited) return true; std::ostringstream out; if (!isOpk()) {