Skip to content

Commit a9c716f

Browse files
committed
Stop chat when editor is closed
Add a listener for EditorManager::editorAboutToClose that calls onStopRequested() when the current ChatEditor instance is being closed. This ensures the chat session stops cleanly when the editor window is closed, preventing a crash upon receiving data.
1 parent 9544d79 commit a9c716f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llamachateditor.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,14 @@ ChatEditor::ChatEditor()
185185
}
186186
});
187187

188+
connect(EditorManager::instance(),
189+
&EditorManager::editorAboutToClose,
190+
this,
191+
[this](Core::IEditor *editor) {
192+
if (editor == this)
193+
onStopRequested();
194+
});
195+
188196
// Search in chat (Ctrl+F)
189197
ActionBuilder startSearchAction(this, Core::Constants::FIND_IN_DOCUMENT);
190198
startSearchAction.setText(Tr::tr("Search in chat"));

0 commit comments

Comments
 (0)