android/usb: better memory management

Instead of relying on the std::vector staying unchanged and not freeing
its members, instead keep a copy of the object in our DCDeviceData class.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-03-15 15:12:30 -07:00
parent 0b72495413
commit 2265a27912
3 changed files with 12 additions and 4 deletions

View file

@ -2024,7 +2024,7 @@ void QMLManager::DC_setDevName(const QString& devName)
for (unsigned int i = 0; i < androidSerialDevices.size(); i++) {
if (androidSerialDevices[i].uiRepresentation == connection) {
appendTextToLog(QString("setDevName matches USB device %1").arg(i));
DCDeviceData::instance()->setUsbDevice((void *)&androidSerialDevices[i]);
DCDeviceData::instance()->setUsbDevice(androidSerialDevices[i]);
}
}
#endif