[Qt-creator] closeEditors

Knut Petter Svendsen knutpett+qtcreator at pvv.org
Wed Sep 13 15:40:44 CEST 2023


Hi everyone,

I'm currently working on a plugin where I aim to achieve the following
functionality:

```
Given I open file "filename1.cpp"
Then immediately open "filename2.cpp"
And close "filename1.cpp" so it is not in the "open documents".
```

I have a slot connected to
`EditorManager::currentEditorChanged(IEditor*)`. In this slot, I perform a
condition check and subsequently execute `EditorManager::openEditor()`
with the other file, which works smoothly. However, when attempting to
close the first file with
EditorManager::closeEditors({EditorManager::currentEditor()}) (not even
opening the second file), I encounter a segfault at
`LanguageClient::SemanticTokenSupport::onCurrentEditorChanged`.

Why is this not be functioning as expected, and I wonder if there might be
a more effective solution?




More information about the Qt-creator mailing list