commit a6ca2c18fe318d7a319b382bfda230651cb479de
parent 4be4051c3c86b675515a121e142519c71f9893fb
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date: Tue, 27 Aug 2024 20:40:35 +0200
fix crash when dragging patch from patch manager onto a part button
Diffstat:
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/doc/changelog.txt b/doc/changelog.txt
@@ -2,6 +2,10 @@ Release Notes
1.3.20
+Framework:
+
+- [Fix] Crash when dragging a patch from Patch Manager to a part slot
+
NodalRed2x:
- [Fix] UI state not updated when loading preset via DAW
diff --git a/source/jucePluginEditorLib/partbutton.cpp b/source/jucePluginEditorLib/partbutton.cpp
@@ -33,7 +33,7 @@ namespace jucePluginEditorLib
const auto* savePatchDesc = patchManager::SavePatchDesc::fromDragSource(_dragSourceDetails);
if(savePatchDesc)
- return savePatchDesc->getPart() != getPart();
+ return !savePatchDesc->isPartValid() || savePatchDesc->getPart() != getPart();
const auto patch = getPatchFromDragSource(_dragSourceDetails);
return patch.first != nullptr;
@@ -99,9 +99,13 @@ namespace jucePluginEditorLib
if(savePatchDesc)
{
- if(savePatchDesc->getPart() == m_part)
- return;
- pm->copyPart(m_part, static_cast<uint8_t>(savePatchDesc->getPart()));
+ // part is not valid if the drag source is the patch manager
+ if(savePatchDesc->isPartValid())
+ {
+ if(savePatchDesc->getPart() == getPart())
+ return;
+ pm->copyPart(m_part, static_cast<uint8_t>(savePatchDesc->getPart()));
+ }
}
const auto [patch, list] = getPatchFromDragSource(_dragSourceDetails);