I have some QML code using QtQuick.Controls 1.4
from Qt 5.6.1. I have some wrappers around various controls, such as ComboBox
; these make use of Style
objects. For instance, MyComboBox
is a ComboBox
with a custom ComboBoxStyle
.
Every so often, when certain components are loaded, the control
property in the Style
object is null
:
In MyComboBox.qml
:
...
style: ComboBoxStyle {
...
label: Label {
text: control.currentText
...
The resulting error output is:
qrc:/MyComboBox.qml:72: TypeError: Cannot read property 'currentText' of null
Restarting the application typically fixes the error.
I have no idea how this could happen or why the error appears non-deterministic. What can I do to investigate?
This appears to have been fixed in release 5.6.1-1; since upgrading, we have not observed this error. Presumably we were simply observing one of the less-critical symptoms of QTBUG-53761.
Credit to jpnurmi for recognizing the similarity of the symptoms I described to the behavior of the bug, and for notifying me that a release with a fix was available (which, sadly, is not evident on the Qt 5.6 release-series page).