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:
David Schulz
2023-05-23 09:32:33 +02:00
parent 00d156c8ca
commit 305fae9a4a
3 changed files with 16 additions and 1 deletions

View File

@@ -60,5 +60,13 @@ void CopilotPlugin::restartClient()
CopilotSettings::instance().distPath());
}
ExtensionSystem::IPlugin::ShutdownFlag CopilotPlugin::aboutToShutdown()
{
if (!m_client)
return SynchronousShutdown;
connect(m_client, &QObject::destroyed, this, &IPlugin::asynchronousShutdownFinished);
return AsynchronousShutdown;
}
} // namespace Internal
} // namespace Copilot