Skip to content

QTBUG-81247 Work around QML touch docker refreshing after app exit

Parented QObjects are deleted after their ancestors, so as a last throe, the QML engine refreshes its properties and sets its mainWindow to NULL.

This commit ensures the QQuickWidget is gone before its parent, while also ensuring there's not an attempted double free à la PyQt5.

See https://bugreports.qt.io/browse/QTBUG-81247

Test Plan

Build and open Krita. Then close Krita.

Check that the Touch Docker is destroyed without the following console warnings:

qrc:/touchstrip.qml:69: TypeError: Cannot call method 'iconForButton' of null
qrc:/touchstrip.qml:55: TypeError: Cannot call method 'iconForButton' of null
qrc:/touchstrip.qml:218: TypeError: Cannot call method 'iconForButton' of null
qrc:/touchstrip.qml:218: TypeError: Cannot read property 'iconForButton' of null
qrc:/touchstrip.qml:198: TypeError: Cannot call method 'iconForButton' of null
qrc:/touchstrip.qml:198: TypeError: Cannot read property 'iconForButton' of null
qrc:/touchstrip.qml:170: TypeError: Cannot call method 'iconForButton' of null
qrc:/touchstrip.qml:170: TypeError: Cannot read property 'iconForButton' of null
qrc:/touchstrip.qml:135: TypeError: Cannot read property 'iconForButton' of null
qrc:/touchstrip.qml:135: TypeError: Cannot read property 'iconForButton' of null
qrc:/touchstrip.qml:135: TypeError: Cannot read property 'iconForButton' of null
qrc:/touchstrip.qml:114: TypeError: Cannot call method 'iconForButton' of null
qrc:/touchstrip.qml:114: TypeError: Cannot read property 'iconForButton' of null
qrc:/touchstrip.qml:93: TypeError: Cannot call method 'iconForButton' of null
qrc:/touchstrip.qml:93: TypeError: Cannot read property 'iconForButton' of null

Krita must also not crash.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Merge request reports