(fix) Controller: clear mapping pointer when unloading a mapping#13907
Conversation
| void setMapping(std::shared_ptr<LegacyControllerMapping> pMapping) override; | ||
| void clearMapping() override { | ||
| m_pMapping = nullptr; | ||
| } |
There was a problem hiding this comment.
just call setMapping with a nullptr directly.
There was a problem hiding this comment.
That was the first thing I tried.
Gives me this when selecting No mapping
DEBUG ASSERT: "pMapping.use_count() == 1" in function std::shared_ptr<_Tp> Controller::downcastAndTakeOwnership(std::shared_ptr<LegacyControllerMapping>&&) [with SpecificMappingType = LegacyMidiControllerMapping] at ./src/controllers/controller.h:89
There was a problem hiding this comment.
mixxx/src/controllers/controller.h
Lines 82 to 96 in 815219d
There was a problem hiding this comment.
right, that function does not take that usecase into account. Simply add a if (pMapping == nullptr) { return nullptr; } so it supports that usecase. Alternatively you can add the appropriate handling to the setMapping implementations.
There was a problem hiding this comment.
Okay. I only took a brief look at this and didn't want to touch it.
But yeah, that's a straight forward solution.
Thanks!
Not that I know of, possibly lost during refactoring? |
eb6f94a to
e6fb932
Compare
Swiftb0y
left a comment
There was a problem hiding this comment.
conceptually LGTM. Thank you. Waiting for CI.
|
Ready for merge, right? |
|
Hmm I dont see how this could be related. |
|
Yes, probably, not but at least it touches the same code. |
With #13842 I noticed that the controller's pMapping still points to the previously loaded mapping when loading 'No mapping'.
Is there any reason for that?