Bug 408719 - Customized MenuItem/ComboBox causes TypeErrors in QtQuick/Controls.2/org.kde.desktop/
Summary: Customized MenuItem/ComboBox causes TypeErrors in QtQuick/Controls.2/org.kde....
Status: RESOLVED FIXED
Alias: None
Product: frameworks-qqc2-desktop-style
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.59.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-15 02:46 UTC by Lukas Spies
Modified: 2019-07-01 10:33 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.60
Sentry Crash Report:


Attachments
sample app producing described TypeErrors (1.73 KB, application/gzip)
2019-06-15 02:46 UTC, Lukas Spies
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Spies 2019-06-15 02:46:48 UTC
Created attachment 120881 [details]
sample app producing described TypeErrors

SUMMARY

I created a very basic QML application (attached) that is based on QApplication (and not QGuiApplication). I then add a Menu with a MenuItem that has a custom contentItem set. When run the engine will produce a TypeError (though everything still seems to work):
file:///usr/lib/qt/qml/QtQuick/Controls.2/org.kde.desktop/MenuItem.qml:98: TypeError: Cannot read property 'height' of null

Similarly, when adding a ComboBox also with customized contentItem then the engine produces 5 TypeErrors for each instance of the ComboBox:
file:///usr/lib/qt/qml/QtQuick/Controls.2/org.kde.desktop/ComboBox.qml:52: TypeError: Cannot read property 'pressed' of null
file:///usr/lib/qt/qml/QtQuick/Controls.2/org.kde.desktop/ComboBox.qml:178: TypeError: Cannot read property 'selectionStart' of null
file:///usr/lib/qt/qml/QtQuick/Controls.2/org.kde.desktop/private/MobileTextActionsToolBar.qml:62: TypeError: Cannot read property 'selectedText' of null
file:///usr/lib/qt/qml/QtQuick/Controls.2/org.kde.desktop/private/MobileTextActionsToolBar.qml:70: TypeError: Cannot read property 'selectedText' of null
file:///usr/lib/qt/qml/QtQuick/Controls.2/org.kde.desktop/private/MobileTextActionsToolBar.qml:78: TypeError: Cannot read property 'canPaste' of null

The TypeError for the MenuItem can be hidden when adding the following line:
arrow: Item {}

I have not figured out a solution to prevent the 5 TypeErrors for the ComboBox.


STEPS TO REPRODUCE
1. Compile attached sample app
2. Run app
3. 

OBSERVED RESULT
1 TypeError due to the MenuItem, 5 TypeErrors due to the ComboBox.


EXPECTED RESULT
No TypeErrors.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.16.0
KDE Frameworks Version: 5.59.0
Qt Version: 5.12.3
Comment 1 Lukas Spies 2019-06-15 03:02:53 UTC
Edit: Changed Product to 'unknown'. I had it as Kirigami initially as the first TypeError happens in a line where Kirigami shows up, but it seems to be due to some id problems outside of Kirigami. I don't know which product this falls under, hence 'unknown'.
Comment 2 Nate Graham 2019-06-15 16:33:33 UTC
Always better to guess at the product rather than use Unknown. Why do we even have that lol?
Comment 3 Alexander Potashev 2019-06-30 17:10:32 UTC
This happens when I click in a TextField in my tiny QML app:

file:///usr/lib64/qt5/qml/QtQuick/Controls.2/org.kde.desktop/private/MobileTextActionsToolBar.qml:61: TypeError: Cannot read property 'selectedText' of null
file:///usr/lib64/qt5/qml/QtQuick/Controls.2/org.kde.desktop/private/MobileTextActionsToolBar.qml:69: TypeError: Cannot read property 'selectedText' of null
Comment 4 David Faure 2019-07-01 10:33:37 UTC
Git commit a759ed533f8bdc6eef287589706a9199387bb15e by David Faure.
Committed on 01/07/2019 at 10:33.
Pushed by dfaure into branch 'master'.

MobileTextActionsToolBar: fix runtime warnings when controlRoot isn't set yet

Summary:
This file checks for controlRoot being undefined, everywhere else.
FIXED-IN: 5.60

Test Plan:
`qmlscene tests/testComboBox.qml` showed
MobileTextActionsToolBar.qml:62: TypeError: Cannot read property 'selectedText' of null
MobileTextActionsToolBar.qml:70: TypeError: Cannot read property 'selectedText' of null
MobileTextActionsToolBar.qml:78: TypeError: Cannot read property 'canPaste' of null

Reviewers: mart, apol, broulik, ngraham

Reviewed By: apol, ngraham

Subscribers: astippich, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D21514

M  +3    -3    org.kde.desktop/private/MobileTextActionsToolBar.qml

https://commits.kde.org/qqc2-desktop-style/a759ed533f8bdc6eef287589706a9199387bb15e