diff options
| author | Fabian Kosmale <[email protected]> | 2018-04-06 17:57:38 +0200 |
|---|---|---|
| committer | Fabian Kosmale <[email protected]> | 2018-04-08 11:44:26 +0200 |
| commit | 3a028d9db0ee4cdd9103d9ab375f95d985539fd2 (patch) | |
| tree | df9104c943e434f3104f9264c0b29b3c7e362c1f /src/kitemviews/kitemlistselectionmanager.cpp | |
| parent | 5413025f0b26e9b195d1117bb483fbfe42e8c8c8 (diff) | |
use the same bound check as setCurrentItem when setting m_currentItem manually
Summary:
This patch basically adds the check that would normally be done to the
itemInserted method, which seems to be good idea in general.
However, the fact that this is needed there might be an indicator of a logic bug
in the function – though, as I'm not familiar with the code base I cannot judge
this.
Test Plan:
Without this patch, dolphin when started from a terminal prints the following
warning (number can be different):
qt.accessibility.core: Cannot create accessible child interface for object: PlacesView(0x563e863e35c0) index: 10
After applying the patch, the warning doesn't appear anymore. Dolphin still
works still as it did before.
Reviewers: elvisangelaccio, #dolphin
Reviewed By: elvisangelaccio
Subscribers: #dolphin
Differential Revision: https://phabricator.kde.org/D11990
Diffstat (limited to 'src/kitemviews/kitemlistselectionmanager.cpp')
| -rw-r--r-- | src/kitemviews/kitemlistselectionmanager.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/kitemviews/kitemlistselectionmanager.cpp b/src/kitemviews/kitemlistselectionmanager.cpp index efc256e1e..f5e097c02 100644 --- a/src/kitemviews/kitemlistselectionmanager.cpp +++ b/src/kitemviews/kitemlistselectionmanager.cpp @@ -235,6 +235,9 @@ void KItemListSelectionManager::itemsInserted(const KItemRangeList& itemRanges) // Calling setCurrentItem would trigger the selectionChanged signal, but we want to // emit it only once in this function -> change the current item manually and emit currentChanged m_currentItem += inc; + if (m_currentItem >= m_model->count()) { + m_currentItem = -1; + } emit currentChanged(m_currentItem, previousCurrent); } |
