forked from qt-creator/qt-creator
Editor: delete the processor that proposes a result
Not the currently active one. Change-Id: Ia0e146e61c07564107ca5a3ec6b5b2d65967f572 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -252,18 +252,18 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason,
|
||||
break;
|
||||
}
|
||||
case IAssistProvider::Asynchronous: {
|
||||
processor->setAsyncCompletionAvailableHandler([this, reason](IAssistProposal *newProposal) {
|
||||
processor->setAsyncCompletionAvailableHandler([this, reason, processor](IAssistProposal *newProposal) {
|
||||
// do not delete this processor directly since this function is called from within the processor
|
||||
QTimer::singleShot(0, [processor = m_asyncProcessor]() { delete processor; });
|
||||
if (m_asyncProcessor && m_asyncProcessor->needsRestart() && m_receivedContentWhileWaiting) {
|
||||
QTimer::singleShot(0, [processor]() { delete processor; });
|
||||
if (processor != m_asyncProcessor)
|
||||
return;
|
||||
invalidateCurrentRequestData();
|
||||
if (processor && processor->needsRestart() && m_receivedContentWhileWaiting) {
|
||||
delete newProposal;
|
||||
m_receivedContentWhileWaiting = false;
|
||||
invalidateCurrentRequestData();
|
||||
requestProposal(reason, m_assistKind, m_requestProvider);
|
||||
} else {
|
||||
invalidateCurrentRequestData();
|
||||
displayProposal(newProposal, reason);
|
||||
|
||||
emit q->finished();
|
||||
}
|
||||
});
|
||||
@@ -275,6 +275,7 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason,
|
||||
} else if (!processor->running()) {
|
||||
delete processor;
|
||||
} else { // ...async request was triggered
|
||||
QTC_CHECK(!m_asyncProcessor);
|
||||
m_asyncProcessor = processor;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user