forked from qt-creator/qt-creator
Copilot: correctly cleanup compression timer
fixes a leak and a crash if the timer triggers after the widget was deleted. Change-Id: I57794009186d4c5e4dee0b0c0746ffc5468000b7 Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io> Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -108,6 +108,11 @@ void CopilotClient::scheduleRequest(TextEditorWidget *editor)
|
|||||||
m_scheduledRequests[editor].timer->start(500);
|
m_scheduledRequests[editor].timer->start(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CopilotClient::ScheduleData::~ScheduleData()
|
||||||
|
{
|
||||||
|
delete timer;
|
||||||
|
}
|
||||||
|
|
||||||
void CopilotClient::requestCompletions(TextEditorWidget *editor)
|
void CopilotClient::requestCompletions(TextEditorWidget *editor)
|
||||||
{
|
{
|
||||||
Utils::MultiTextCursor cursor = editor->multiTextCursor();
|
Utils::MultiTextCursor cursor = editor->multiTextCursor();
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ private:
|
|||||||
QMap<TextEditor::TextEditorWidget *, GetCompletionRequest> m_runningRequests;
|
QMap<TextEditor::TextEditorWidget *, GetCompletionRequest> m_runningRequests;
|
||||||
struct ScheduleData
|
struct ScheduleData
|
||||||
{
|
{
|
||||||
|
~ScheduleData();
|
||||||
int cursorPosition = -1;
|
int cursorPosition = -1;
|
||||||
QTimer *timer = nullptr;
|
QTimer *timer = nullptr;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user