bugfix: 332596 - crash when exiting unfinished practice
Review Request #119119 - Created July 4, 2014 and submitted
Problem: The bug was that if the qstyled KLineEdit answerEdit held focus when the WrittenPracticeWidget was deleted, then a focus event passed to the deleted KLineEdit would be passed to the QStyleSheet and return an invalid pointer to an already deleted QStyle.
Fix: This patch sets the focus to helpLabel before the object is deleted. It does this by calling modeWidgetDestroyed(), which calls objectDestroyed() before the focus changing event will be invalid.
Replicated the GUI conditions of the bug by hand, before and after the fix.
Good debugtool! I will steal this idea for other times. :)
But not good to have in production code. You must delete this before committing.
This should also be removed before commit.
I think the comment should be "m_floatingToolBar is a child of this class and will be deleted automatically".
Or actually just remove this line. There is no need to set it to zero in the destructor because it will never be used again.
As usual, comment out the kDebugs before committing.
The fix itself looks good but there is a lot of stuff that you used in the debugging that should be disabled or removed before commit.
I commited the obvious changes where ownership was passed out of the seperately and just left the core of the bug fix in this new version of the patch.
Do the comments in the code clearly explain the problem, the solution and when the solution can be removed from the code?
Revision 2 (+67 -1)
This bug fix needs to be added into 4.14.
It is a 100% unavoidable crash if someone is using stylesheets and mixed letters or written word methods/games.
In frameworks, KEditLine is deprecated so the problem will probably go away on its own.
Despite two small issues, the code looks sane
Though for my taste, it feels not the proper approach to work around the problem this way... But since the patch can be removed for KF5 this concern should not have much weight. Actually, it fixes a crash. :)
IMO it would be good if this patch still can be included into Beta 3 to give it some testing and check for stability until RC1.