forked from qt-creator/qt-creator
Device support: Copy device object when adding to device manager.
Otherwise the caller might (inadvertantly) keep a non-const object around and change it behind the device manager's back. Change-Id: I71b3e83e94397416b843006e74dcc1924abed77b Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -218,9 +218,10 @@ QString DeviceManager::settingsFilePath()
|
|||||||
return QFileInfo(pm->settings()->fileName()).absolutePath() + QLatin1String("/devices.xml");
|
return QFileInfo(pm->settings()->fileName()).absolutePath() + QLatin1String("/devices.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::addDevice(const IDevice::Ptr &device)
|
void DeviceManager::addDevice(const IDevice::Ptr &_device)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(this != instance() || (device->isAutoDetected()), return);
|
const IDevice::Ptr device = _device->clone();
|
||||||
|
QTC_ASSERT(this != instance() || device->isAutoDetected(), return);
|
||||||
|
|
||||||
QString name = device->displayName();
|
QString name = device->displayName();
|
||||||
const int pos = indexForId(device->id());
|
const int pos = indexForId(device->id());
|
||||||
|
Reference in New Issue
Block a user