diff --git a/src/controllers/controller.h b/src/controllers/controller.h index 2c91e7d0ba7e..9d8ac370a1e3 100644 --- a/src/controllers/controller.h +++ b/src/controllers/controller.h @@ -81,6 +81,10 @@ class Controller : public QObject { template std::shared_ptr downcastAndTakeOwnership( std::shared_ptr&& pMapping) { + // When unsetting a mapping (select 'No mapping') we receive a nullptr + if (pMapping == nullptr) { + return nullptr; + } // Controller cannot take ownership if pMapping is referenced elsewhere because // the controller polling thread needs exclusive accesses to the non-thread safe // LegacyControllerMapping. diff --git a/src/controllers/controllermanager.cpp b/src/controllers/controllermanager.cpp index abfb47b40c9b..e5cba1c27c43 100644 --- a/src/controllers/controllermanager.cpp +++ b/src/controllers/controllermanager.cpp @@ -423,6 +423,7 @@ void ControllerManager::slotApplyMapping(Controller* pController, if (!pMapping) { closeController(pController); // Unset the controller mapping for this controller + pController->setMapping(nullptr); m_pConfig->remove(key); emit mappingApplied(false); return;