forked from qt-creator/qt-creator
Copilot: shutdown plugin asynchronously
Wait for the client to finish. This fixes a crash when running the plugin unit tests of the copilot plugin. Change-Id: Id0805cb628a79316cd904350bb159ff1369a03b9 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -237,7 +237,13 @@ void LanguageClientManager::deleteClient(Client *client)
|
||||
managerInstance->m_clients.removeAll(client);
|
||||
for (QList<Client *> &clients : managerInstance->m_clientsForSetting)
|
||||
clients.removeAll(client);
|
||||
client->deleteLater();
|
||||
|
||||
// a deleteLater is not sufficient here as it pastes the delete later event at the end
|
||||
// of the main event loop and when the plugins are shutdown we spawn an additional eventloop
|
||||
// that will not handle the delete later event. Use invokeMethod with Qt::QueuedConnection
|
||||
// instead.
|
||||
QMetaObject::invokeMethod(client, [client] {delete client;}, Qt::QueuedConnection);
|
||||
|
||||
if (!PluginManager::isShuttingDown())
|
||||
emit instance()->clientRemoved(client);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user