Review Request 127108: Changed way of saving files which fixes some bugs

Christian David christian-david at web.de
Thu Feb 18 11:00:16 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127108/
-----------------------------------------------------------

Review request for KMymoney.


Bugs: 356399
    http://bugs.kde.org/show_bug.cgi?id=356399


Repository: kmymoney


Description
-------

Fixed potential memory leak during saving

A pointer was not deleted before throwing exceptions in
KMyMoneyView::saveFile. Also renamed the pointer.

Changed way of saving files which fixes some bugs

The save operation seems to fail every time - it never changed the orginal
file and never reported any issues. I did not find the exact reason for
this bug but I am quite sure it was caused by an incorret usage of
QSaveFile (under some circumstances close() instead of commit() was
called).

Now KMyMoney creates its own temporary file to write to (if needed).
This also works using KGpgFile, which should fix Bug 356399.

The remove() and rename() operations are not atomic which is not so
good as this could result in dataloss if the first operation fails.
However, this is the best OS independet process I could find.

Errors during writing of compressed files may not be detected. I think
this issue should be fixed upstream.

I did not get how the old system worked it seems cluttered so I decided to rewrite it.
Sorry for putting two commits into this reviewrequest. 

CCBUG: 356399


Diffs
-----

  CMakeLists.txt 7608073e3dee8a439a9e2ca1c6c343704cd9cf6e 
  kmymoney/views/kmymoneyview.h be737db44f821f56256b4e92bbbbdf8e2e158bfa 
  kmymoney/views/kmymoneyview.cpp 2820b151847fb5dea9b1dff264ebb68a5360d942 

Diff: https://git.reviewboard.kde.org/r/127108/diff/


Testing
-------

I saved a file several times using the compressed, uncompressed and anonymous format. I could not test the GPG part because none of my keys is currently shown by the save dialog.


Thanks,

Christian David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20160218/cb234cef/attachment.html>


More information about the KMyMoney-devel mailing list