mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-09-27 03:39:11 +00:00
fix: crash on repeat disconnect
This commit is contained in:
parent
78cc026ddb
commit
4f12e13a7e
1 changed files with 5 additions and 2 deletions
|
@ -464,8 +464,11 @@ void Dialog::onDeviceConnected(bool success, const QString &serial, const QStrin
|
||||||
void Dialog::onDeviceDisconnected(QString serial)
|
void Dialog::onDeviceDisconnected(QString serial)
|
||||||
{
|
{
|
||||||
GroupController::instance().removeDevice(serial);
|
GroupController::instance().removeDevice(serial);
|
||||||
|
auto device = qsc::IDeviceManage::getInstance().getDevice(serial);
|
||||||
auto data = qsc::IDeviceManage::getInstance().getDevice(serial)->getUserData();
|
if (!device) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto data = device->getUserData();
|
||||||
if (data) {
|
if (data) {
|
||||||
VideoForm* vf = static_cast<VideoForm*>(data);
|
VideoForm* vf = static_cast<VideoForm*>(data);
|
||||||
qsc::IDeviceManage::getInstance().getDevice(serial)->deRegisterDeviceObserver(vf);
|
qsc::IDeviceManage::getInstance().getDevice(serial)->deRegisterDeviceObserver(vf);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue