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,20 +850,20 @@ IAssistProposal *InternalCppCompletionAssistProcessor::createContentProposal()
|
|||||||
QSet<QString> processed;
|
QSet<QString> processed;
|
||||||
auto it = m_completions.begin();
|
auto it = m_completions.begin();
|
||||||
while (it != m_completions.end()) {
|
while (it != m_completions.end()) {
|
||||||
auto item = static_cast<CppAssistProposalItem *>(*it);
|
if ((*it)->isSnippet()) {
|
||||||
if (!processed.contains(item->text()) || item->isSnippet()) {
|
|
||||||
++it;
|
++it;
|
||||||
if (!item->isSnippet()) {
|
} else if (!processed.contains((*it)->text())) {
|
||||||
processed.insert(item->text());
|
auto item = static_cast<CppAssistProposalItem *>(*it);
|
||||||
if (!item->isOverloaded()) {
|
processed.insert(item->text());
|
||||||
if (auto symbol = qvariant_cast<Symbol *>(item->data())) {
|
if (!item->isOverloaded()) {
|
||||||
if (Function *funTy = symbol->type()->asFunctionType()) {
|
if (auto symbol = qvariant_cast<Symbol *>(item->data())) {
|
||||||
if (funTy->hasArguments())
|
if (Function *funTy = symbol->type()->asFunctionType()) {
|
||||||
item->markAsOverloaded();
|
if (funTy->hasArguments())
|
||||||
}
|
item->markAsOverloaded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
++it;
|
||||||
} else {
|
} else {
|
||||||
delete *it;
|
delete *it;
|
||||||
it = m_completions.erase(it);
|
it = m_completions.erase(it);
|
||||||
|
Reference in New Issue
Block a user