Mod Matrix bug - hopefully squashed
-
One for @Christoph-Hart . I've been getting straight crashes for a while to do with hovering above modulated sliders, and constructing the modulation dragger / info popup. Anyway Claude has helped find a fix for this. I'll post the crash report then Claude's answer and fix:
Crash report:
Thread 0 Crashed:: JUCE Message Thread Dispatch queue: com.apple.main-thread 0 HISE 0x104e7e034 hise::MatrixIds::Helpers::IntensityTextConverter::IntensityTextConverter(hise::MatrixIds::Helpers::IntensityTextConverter::ConstructData const&) + 80 1 HISE 0x104c8cd48 hise::HiSlider::HoverPopup::rebuild() + 1652 2 HISE 0x104c8c498 hise::HiSlider::HoverPopup::HoverPopup(hise::HiSlider&, juce::ValueTree const&, juce::String const&, juce::Array<int, juce::DummyCriticalSection, 0> const&, juce::StringArray const&, hise::HiSlider::HoverPopupLookandFeel::PositionData const&, bool) + 3352 3 HISE 0x104c90f1c hise::HiSlider::ModUpdater::onExclusiveSourceSelection(hise::HiSlider::ModUpdater&, int) + 532 4 HISE 0x104c928b4 hise::SafeLambda<hise::HiSlider::ModUpdater, void, int>::call(int) + 60 5 HISE 0x104c89b0c hise::HiSlider::setup(hise::Processor*, int, juce::String const&) + 1600 6 HISEFIX in MacroControlledComponents.cpp:
The bug is here:
onExclusiveSourceSelectionis called duringsetup()viasetUpdateFunction() → container->currentMatrixSourceBroadcaster.addListener(*this, ModUpdater::onExclusiveSourceSelection)which fires immediately.
At that point during a content rebuild,slider.getProcessor()may still be valid butmod->getIntensityTextConstructData()is returning a ConstructData struct with a null or invalid member - specifically at offset +80 into the constructor, which is the 3rd or 4th member being initialised.
The fix for Christoph is thatonExclusiveSourceSelectionshould not create a HoverPopup during setup() - it needs a guard:void HiSlider::ModUpdater::onExclusiveSourceSelection(ModUpdater& mu, int index) { // Guard: don't rebuild hover popup if component isn't visible yet if(!mu.parent.isShowing()) return; // ... rest of function }EDIT - Bit more info:
- Crash is at cd.connectedSlider = parent.getComponent()
- During compile/rebuild, parent.getComponent() returns a pointer to a component that's being destroyed
- Component::SafePointer constructor tries to register with the component's ComponentVTable which is already partially destroyed
- Fix: null check parent.getComponent() before constructing, or defer HoverPopup creation until after rebuild is complete
void HiSlider::ModUpdater::onExclusiveSourceSelection(ModUpdater& mu, int index) { auto& slider = mu.parent; if(!slider.isShowing()) return; auto matrixData = MatrixIds::Helpers::getMatrixDataFromGlobalContainer(slider.getProcessor()->getMainController()); auto targetId = slider.getProcessor()->getModulationTargetId(slider.getParameter()); auto hasConnection = MatrixIds::Helpers::getConnection(matrixData, index, targetId).isValid(); if (hasConnection) { mu.currentExlusiveIndex = index; Array<int> connectedSources; connectedSources.add(index); StringArray allSources, sourceList; MatrixIds::Helpers::fillModSourceList(slider.getProcessor()->getMainController(), allSources); sourceList.add(allSources[index]); if (auto pd = slider.getHoverPopupLookAndFeel().getModulatorDragData(slider, sourceList)) slider.currentHoverPopup = new HoverPopup(slider, matrixData, targetId, connectedSources, sourceList, pd, true); } else { mu.currentExlusiveIndex = -1; slider.currentHoverPopup = nullptr; } } -
@DanH
In which DAW does your plug-in crash? -
@Oli-Ullmann this is in Hise itself
-
@DanH
Oh, ok. That hasn't happened to me yet. I'll test it thoroughly again. Thank you. -
@Oli-Ullmann doesn't happen in a small project, just my big one, but hopefully found the culprit. drag and dropping components in the component list could also trigger the crash....