Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
4.7.4, 4.8.x
-
None
-
Mac OS X 10.6, Ubuntu
-
ee60e9c88c43cc33dc94a4cec79c62ffdf02ce58
Description
While using the Qt Components for Desktop I've run into a crash that happened when using the TextField component inside a delegate. The cause for the crash lies within the implementation of TextField:
onFocusChanged: {
if (textField.activeFocus) {
textInput.forceActiveFocus();
}
}
This handler is called from QGraphicsItemPrivate::setParentItemHelper after "ensuring any last parent focus scope does not point to this item or any of its descendents".
The problems start when the focus is modified from inside the handler. In this case the clearing is reverted and the focusScopeItem pointer again points to the item that will no longer be a descendant of the old parent.
Now when that item is being deleted, it will no longer clear itself from that old parent, so we have a dangling pointer there that will cause a crash sooner or later (whenever the focus scope item list is being iterated through).
The proposed fix is attached as a patch.