CodeAssist: use shared pointer to pass around proposal models

Task-number: QTCREATORBUG-17752
Change-Id: Ia41f169b86ead209830e6f15764062389ced2b67
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
David Schulz
2018-02-14 14:32:51 +01:00
parent 4598a78980
commit a4b5fc00a8
34 changed files with 112 additions and 134 deletions

View File

@@ -280,7 +280,6 @@ void CodeAssistantPrivate::displayProposal(IAssistProposal *newProposal, AssistR
return;
// TODO: The proposal should own the model until someone takes it explicitly away.
QScopedPointer<IAssistProposalModel> proposalCandidateModel(newProposal->model());
QScopedPointer<IAssistProposal> proposalCandidate(newProposal);
bool destroyCurrentContext = false;
@@ -336,7 +335,7 @@ void CodeAssistantPrivate::displayProposal(IAssistProposal *newProposal, AssistR
m_proposalWidget->setKind(m_assistKind);
m_proposalWidget->setBasePosition(basePosition);
m_proposalWidget->setUnderlyingWidget(m_editorWidget);
m_proposalWidget->setModel(proposalCandidateModel.take());
m_proposalWidget->setModel(m_proposal->model());
m_proposalWidget->setDisplayRect(m_editorWidget->cursorRect(basePosition));
m_proposalWidget->setIsSynchronized(!m_receivedContentWhileWaiting);
m_proposalWidget->showProposal(prefix);