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

Christian David christian-david at web.de
Mon Mar 14 20:32:22 UTC 2016


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

(Updated March 14, 2016, 9:32 p.m.)


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 should fix 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.

BUG: 356399
FIXED-IN: 5.0
REVIEW: 127108

Fixed bug while saving GPG encrypted files

A call to QSaveFile::commit() was missing. So QSaveFile always assumed
an error and discarded the changes.

Used this fix for minor clean-ups.


Diffs
-----

  CMakeLists.txt a82d70eed87c5f8a8052b969c0a8a17d82ef8b1d 
  kmymoney/views/kmymoneyview.h c4a769c2bf88083ea56283d683d7f0f7f0466875 
  kmymoney/views/kmymoneyview.cpp 284bd6a2657982c25790b2428730f279fc86504c 
  libkgpgfile/kgpgfile.cpp b1870be92edb833ed30f369e3e0ca0f320fe147b 

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


Testing (updated)
-------

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.

New: I tested it with GPG encrypted files.

Brand new: Tried to saved in locations I have no write premissions for, to non-existing folders, and write protected files. I tried hard to reproduce bug 256750 - everything seems to be alright.


Thanks,

Christian David

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


More information about the KMyMoney-devel mailing list