BareMetal: Fix crash on shutdown

BareMetal is destroyed before ProjectExplorer.

When DeviceManager clears its device list, it calls the devices' dtors,
which in turn call GdbServerProviderManager::findProvider in order to
unregister.

Since m_instance is already null at this point, this leads to a crash.

Change-Id: I1075433cad5579febddf79b463ffe12cdb75a85c
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Tim Sander <tim@krieglstein.org>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Orgad Shaneh
2017-06-04 18:41:46 +03:00
committed by Orgad Shaneh
parent e9491870bd
commit 41a2ce871e

View File

@@ -161,7 +161,7 @@ QList<GdbServerProviderFactory *> GdbServerProviderManager::factories()
GdbServerProvider *GdbServerProviderManager::findProvider(const QString &id)
{
if (id.isEmpty())
if (id.isEmpty() || !m_instance)
return 0;
return Utils::findOrDefault(m_instance->m_providers, Utils::equal(&GdbServerProvider::id, id));