Commit c5694cc5 authored by Leandro Melo's avatar Leandro Melo Committed by Eike Ziller
Browse files

C++: Fix duplicate items in C++ completion for Qt methods

In the old code completion engine items were created on the stack
and passed around by value. With the refactoring of the code assist
API they became heap objects manipulated through pointers. This
patch fixes one reminiscence not caught during the refactoring
in which the same actual pointer was being used more than once to
be appended on the list.

Change-Id: I2009fb0b6aa18df57aa5ca9bde0591536ca2cd74

Reviewed-by: default avatarQt Sanity Bot <>
Reviewed-by: default avatarFawzi Mohamed <>
(cherry picked from commit a1fa1692)
parent 55606d5d
......@@ -1614,12 +1614,9 @@ bool CppCompletionAssistProcessor::completeQtMethod(const QList<CPlusPlus::Looku
else if (! wantSignals && ! fun->isSlot())
BasicProposalItem *item = toCompletionItem(fun);
if (item) {
unsigned count = fun->argumentCount();
while (true) {
BasicProposalItem *ci = item;
QString signature;
signature += Overview().prettyName(fun->name());
signature += QLatin1Char('(');
......@@ -1637,8 +1634,10 @@ bool CppCompletionAssistProcessor::completeQtMethod(const QList<CPlusPlus::Looku
signature = QString::fromLatin1(normalized, normalized.size());
if (! signatures.contains(signature)) {
BasicProposalItem *ci = toCompletionItem(fun);
if (!ci)
ci->setText(signature); // fix the completion item.
......@@ -1651,7 +1650,6 @@ bool CppCompletionAssistProcessor::completeQtMethod(const QList<CPlusPlus::Looku
return ! m_completions.isEmpty();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment