forked from qt-creator/qt-creator
CppEditor: Fix crash on proposal creation
The assumption that all items are CppAssistProposalItem is wrong.
Snippets items have been AssistProposalItems, and since
22c72f9999
they are SnippetProposalItems.
Change-Id: Ic483741f6e7eb5382d327702600c88d6ec6e30ed
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -850,10 +850,10 @@ IAssistProposal *InternalCppCompletionAssistProcessor::createContentProposal()
|
||||
QSet<QString> processed;
|
||||
auto it = m_completions.begin();
|
||||
while (it != m_completions.end()) {
|
||||
auto item = static_cast<CppAssistProposalItem *>(*it);
|
||||
if (!processed.contains(item->text()) || item->isSnippet()) {
|
||||
if ((*it)->isSnippet()) {
|
||||
++it;
|
||||
if (!item->isSnippet()) {
|
||||
} else if (!processed.contains((*it)->text())) {
|
||||
auto item = static_cast<CppAssistProposalItem *>(*it);
|
||||
processed.insert(item->text());
|
||||
if (!item->isOverloaded()) {
|
||||
if (auto symbol = qvariant_cast<Symbol *>(item->data())) {
|
||||
@@ -863,7 +863,7 @@ IAssistProposal *InternalCppCompletionAssistProcessor::createContentProposal()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
++it;
|
||||
} else {
|
||||
delete *it;
|
||||
it = m_completions.erase(it);
|
||||
|
Reference in New Issue
Block a user