Close KWordQuiz documents before closing the app
ClosedPublic

Authored by yurchor on Jul 6 2019, 2:16 PM.

Details

Summary

The current KWordQuiz fails to close its documents and thus to remove the lock in ~/.local/share/stalefiles/kwordquiz. This issue prevents them to be saved after the next edits (KwordQuiz reports that they are in use by some other application). Moreover, this (and some other things that I could not detect) leads to KwordQuiz crash every time when you close the documents.

Test Plan
  1. Open KWordQuiz.
  2. Type something.
  3. Press Ctrl+Q.
  4. Save document somewhere.
  5. Open KwordQuiz and use "File->Recent documents" to open the saved document again.
  6. Type something.
  7. Press Ctrl+Q.
  8. Confirm saving the document.
  9. The document should be saved without warnings.

Diff Detail

Repository
R338 KWordQuiz
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
yurchor created this revision.Jul 6 2019, 2:16 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptJul 6 2019, 2:16 PM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
yurchor requested review of this revision.Jul 6 2019, 2:16 PM
apol added a subscriber: apol.Jul 6 2019, 2:43 PM

LGTM

src/kwordquiz.cpp
980

static_cast

yurchor added inline comments.Jul 6 2019, 3:08 PM
src/kwordquiz.cpp
980

Does not work with

KWordQuizApp *a =static_cast<KWordQuizApp *>(w);

KWQ refuses to close the window. Works fine without static_cast.

apol added inline comments.Jul 7 2019, 11:14 PM
src/kwordquiz.cpp
980

That doesn't make sense to me. Why would it make a difference?

yurchor added inline comments.Jul 8 2019, 5:53 AM
src/kwordquiz.cpp
980

I do not know. It is just the report with the results of testing (the above-mentioned procedure, can be easily proven).

It would be nice if someone can explain this and why KWQ crashes every time when closed. Thanks in advance for your help.

yurchor updated this revision to Diff 61313.Jul 8 2019, 8:42 AM

A bit simpler patch that works.

yurchor updated this revision to Diff 61412.Jul 9 2019, 2:36 PM

Add comments to the statements

yurchor updated this revision to Diff 61436.Jul 9 2019, 5:38 PM

Fix my typo

aacid added a subscriber: aacid.Jul 15 2019, 11:02 PM
aacid added inline comments.
src/kwordquiz.cpp
984

Do we really need this one? I would expect this KWordQuizApp instance to also be part of memberList.

yurchor marked an inline comment as done.Jul 16 2019, 8:34 AM
yurchor added inline comments.
src/kwordquiz.cpp
984

You are right. It is not needed.

The reason that it appeared here is the wrong testing technique. I just pressed the close window button instead of Ctrl+Q. The next revision should put everything in the right place.

Thanks.

yurchor updated this revision to Diff 61842.Jul 16 2019, 8:42 AM
yurchor marked an inline comment as done.

Put m_doc->close() where it's needed.

aacid accepted this revision.Jul 16 2019, 11:10 PM
This revision is now accepted and ready to land.Jul 16 2019, 11:10 PM
This revision was automatically updated to reflect the committed changes.