Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/controllers/controllermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ void ControllerManager::slotShutdown() {
}

void ControllerManager::updateControllerList() {
// NOTE: Currently this function is only called on startup. If hotplug is added, changes to the
// controller list must be synchronized with dlgprefcontrollers to avoid dangling connections
// and possible crashes.
auto locker = lockMutex(&m_mutex);
if (m_enumerators.isEmpty()) {
qWarning() << "updateControllerList called but no enumerators have been added!";
Expand Down
9 changes: 9 additions & 0 deletions src/controllers/dlgprefcontrollers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ void DlgPrefControllers::rescanControllers() {
}

void DlgPrefControllers::destroyControllerWidgets() {
// NOTE: this assumes that the list of controllers does not change during the lifetime of Mixxx.
// This is currently true, but once we support hotplug, we will need better lifecycle management
// to keep this dialog and the controllermanager consistent.
QList<Controller*> controllerList =
m_pControllerManager->getControllerList(false, true);
for (auto controller : controllerList) {
controller->disconnect(this);
}
while (!m_controllerPages.isEmpty()) {
DlgPrefController* pControllerDlg = m_controllerPages.takeLast();
m_pDlgPreferences->removePageWidget(pControllerDlg);
Expand Down Expand Up @@ -173,6 +181,7 @@ void DlgPrefControllers::setupControllerWidgets() {

connect(pController,
&Controller::openChanged,
this,
[this, pControllerDlg](bool bOpen) {
slotHighlightDevice(pControllerDlg, bOpen);
});
Expand Down