| Summary: | Directly using `modelData` in combobox isn't safe | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] frameworks-qqc2-desktop-style | Reporter: | Emmanuel Lepage Vallée <emmanuel.lepage> |
| Component: | general | Assignee: | Marco Martin <notmart> |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | kde, nate |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Emmanuel Lepage Vallée
2018-12-13 08:55:23 UTC
The code does try to guard it:
org.kde.desktop/ComboBox.qml:
text: controlRoot.textRole ? (Array.isArray(controlRoot.model) ? modelData[controlRoot.textRole] : model[controlRoot.textRole]) : modelData
code in QQC1 was:
text: popup.textRole === '' ?
modelData :
((popup.modelIsArray ? modelData[popup.textRole] : model[popup.textRole]) || '')
@Emmanuel could you test if that works for your "totally fine model"
In my limited testing, this works
text: controlRoot.textRole != undefined ? model[controlRoot.textRole] || "": (
Array.isArray(controlRoot.model) ? modelData[controlRoot.textRole] : modelData
)
|