forked from qt-creator/qt-creator
Editor: fix crash after triggering select all with no search results
Change-Id: I32d5172e8b5df6db93053f358c5a72cb8d38f6ea Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -857,7 +857,10 @@ void TextEditorWidgetFind::selectAll(const QString &txt, FindFlags findFlags)
|
||||
m_selectWatcher = new QFutureWatcher<FileSearchResultList>();
|
||||
connect(m_selectWatcher, &QFutureWatcher<Utils::FileSearchResultList>::finished,
|
||||
this, [this]() {
|
||||
const FileSearchResultList &results = m_selectWatcher->result();
|
||||
const QFuture<FileSearchResultList> future = m_selectWatcher->future();
|
||||
if (future.resultCount() <= 0)
|
||||
return;
|
||||
const FileSearchResultList &results = future.result();
|
||||
const QTextCursor c(m_editor->document());
|
||||
auto cursorForResult = [c](const FileSearchResult &r) {
|
||||
return Utils::Text::selectAt(c, r.lineNumber, r.matchStart + 1, r.matchLength);
|
||||
|
Reference in New Issue
Block a user