forked from qt-creator/qt-creator
Fix a crash in Find Usages
Set the current index of SearchResultWindow to a valid one _before_ deleting the last SerachResultWidget inside the m_widget QStackedWidget, as this triggers the call to updateFilterButton() which uses in turn the current index of SearchResultWindow (out or range in case it's not adjusted beforehand). Fixes: QTCREATORBUG-25713 Change-Id: Ie155c5f9bacee8d647e4fa7f622ff403192cb6bc Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -499,15 +499,15 @@ SearchResult *SearchResultWindow::startNewSearch(const QString &label,
|
||||
const QString &cfgGroup)
|
||||
{
|
||||
if (d->m_searchResults.size() >= MAX_SEARCH_HISTORY) {
|
||||
if (d->m_currentIndex >= d->m_recentSearchesBox->count() - 1) {
|
||||
// temporarily set the index to the last but one existing
|
||||
d->m_currentIndex = d->m_recentSearchesBox->count() - 2;
|
||||
}
|
||||
d->m_searchResultWidgets.last()->notifyVisibilityChanged(false);
|
||||
// widget first, because that might send interesting signals to SearchResult
|
||||
delete d->m_searchResultWidgets.takeLast();
|
||||
delete d->m_searchResults.takeLast();
|
||||
d->m_recentSearchesBox->removeItem(d->m_recentSearchesBox->count()-1);
|
||||
if (d->m_currentIndex >= d->m_recentSearchesBox->count()) {
|
||||
// temporarily set the index to the last existing
|
||||
d->m_currentIndex = d->m_recentSearchesBox->count() - 1;
|
||||
}
|
||||
}
|
||||
auto widget = new SearchResultWidget;
|
||||
connect(widget, &SearchResultWidget::filterInvalidated, this, [this, widget] {
|
||||
|
Reference in New Issue
Block a user