diff options
| author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-04-06 15:14:39 +0200 |
|---|---|---|
| committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-04-11 08:46:58 +0200 |
| commit | f04974751d067ce29c2ce0c53748670c7f383eb5 (patch) | |
| tree | b2aba122816b11ca5df86393ec5c1889a47195ef /src/widgets/doc/snippets/code | |
| parent | 41a349f004fd6afc450b775909d1a96a92df61d8 (diff) | |
QFileSystemModel: don't emit invalid indexes
A subclass of QFileSystemModel might override columnCount to return a
value smalller than QFileSystemModelPrivate::NumColumns.
In that case, constructing the bottomRight index for the dataChange
signal would fail if we create it for column NumColumns - 1, and result
in undefined behavior where the topLeft and bottomRight indices do not
have the same parent.
So ask for the columnCount of the parent index explicitly to construct
the bottomRight index.
The assert can be triggered via the "filesystemexplorer" example in
qtdeclarative, which overrides columnCount to always return 1.
As a drive-by name the variables correctly, bottom and top where mixed
up.
Pick-to: 6.5
Fixes: QTBUG-110632
Change-Id: I8a635ec733348d1eda2037c156ac0f7b09a2183d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/widgets/doc/snippets/code')
0 files changed, 0 insertions, 0 deletions
