[gnote] Fix crash on lock file update



commit a65fb28b063258bbf123dfe67d93f81364973592
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Mon Mar 9 23:47:19 2020 +0200

    Fix crash on lock file update

 src/synchronization/filesystemsyncserver.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/synchronization/filesystemsyncserver.cpp b/src/synchronization/filesystemsyncserver.cpp
index bfe75e56..dbab30e3 100644
--- a/src/synchronization/filesystemsyncserver.cpp
+++ b/src/synchronization/filesystemsyncserver.cpp
@@ -563,10 +563,15 @@ void FileSystemSyncServer::update_lock_file(const SyncLockInfo & syncLockInfo)
     xml.write_end_document();
 
     xml.close();
-    auto stream = m_lock_path->create_file(Gio::FILE_CREATE_REPLACE_DESTINATION);
+    auto stream = m_lock_path->replace();
     stream->write(xml.to_string());
     stream->close();
   }
+  catch(Glib::Error & e) {
+    xml.close();
+    ERR_OUT(_("Error updating lock: %s"), e.what().c_str());
+    throw;
+  }
   catch(...) {
     xml.close();
     throw;


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