Copilot: Various coverity warning fixes

Change-Id: I5d86606611369f4bc11f9f21e308139bba700eb0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-02-27 11:11:02 +01:00
parent 3e73fe302e
commit 4c251486e1
3 changed files with 23 additions and 17 deletions

View File

@@ -14,12 +14,22 @@ using namespace Utils;
namespace Copilot {
namespace Internal {
CopilotPlugin::~CopilotPlugin()
{
if (m_client)
m_client->shutdown();
m_client = nullptr;
}
void CopilotPlugin::initialize()
{
CopilotSettings::instance().readSettings(Core::ICore::settings());
m_client = new CopilotClient();
connect(m_client, &CopilotClient::finished, this, [this]() { m_client = nullptr; });
connect(&CopilotSettings::instance(), &CopilotSettings::applied, this, [this]() {
if (m_client)
m_client->shutdown();