Skip to content

Commit eaec920

Browse files
committed
Fix InfoWindow is still disconnected after the binding device is changed
1 parent a07df40 commit eaec920

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Source/Core/AirPods.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,13 +440,21 @@ class Manager : Helper::NonCopyable
440440
_tracker.Disconnect();
441441
};
442442

443+
const auto &changeButtonToBind = []() {
444+
App->GetInfoWindow()->ChangeButtonActionSafety(Gui::ButtonAction::Bind);
445+
};
446+
443447
GlobalMedia::OnLimitedDeviceStateChanged({});
444448

449+
disconnect();
445450
if (address == 0) {
446-
disconnect();
447451
UpdateUi(Action::WaitingForBinding);
448-
Utils::Qt::Dispatch(
449-
[]() { App->GetInfoWindow()->ChangeButtonActionSafety(Gui::ButtonAction::Bind); });
452+
if (!App->GetInfoWindow()) {
453+
Utils::Qt::Dispatch(changeButtonToBind);
454+
}
455+
else {
456+
changeButtonToBind();
457+
}
450458
return;
451459
}
452460
UpdateUi(Action::Disconnected);

0 commit comments

Comments
 (0)