forked from qt-creator/qt-creator
TextEditor: Fix potential memory leak in code assist
Manually managing the ownership of the code assist objets gets messy. We should use smart pointers. Change-Id: I29fe665e52438a79c3268b74898c583bb302f1fc Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
@@ -229,8 +229,10 @@ void CodeAssistantPrivate::requestProposal(AssistReason reason,
|
|||||||
m_assistKind = kind;
|
m_assistKind = kind;
|
||||||
IAssistProcessor *processor = provider->createProcessor();
|
IAssistProcessor *processor = provider->createProcessor();
|
||||||
AssistInterface *assistInterface = m_editorWidget->createAssistInterface(kind, reason);
|
AssistInterface *assistInterface = m_editorWidget->createAssistInterface(kind, reason);
|
||||||
if (!assistInterface)
|
if (!assistInterface) {
|
||||||
|
delete processor;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (provider->runType()) {
|
switch (provider->runType()) {
|
||||||
case IAssistProvider::Synchronous: {
|
case IAssistProvider::Synchronous: {
|
||||||
|
|||||||
Reference in New Issue
Block a user