Skip to content

Commit

Permalink
Merge pull request #13907 from ronso0/controller-clear-mapping-pointer
Browse files Browse the repository at this point in the history
(fix) Controller: clear mapping pointer when unloading a mapping
  • Loading branch information
daschuer authored Dec 13, 2024
2 parents 9817e5e + e6fb932 commit 0649e88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/controllers/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ class Controller : public QObject {
template<typename SpecificMappingType>
std::shared_ptr<SpecificMappingType> downcastAndTakeOwnership(
std::shared_ptr<LegacyControllerMapping>&& 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.
Expand Down
1 change: 1 addition & 0 deletions src/controllers/controllermanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0649e88

Please sign in to comment.