1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

MPEKeyboardComponent: Catch potential 'use after free' when cleaning up

This commit is contained in:
Oliver James 2024-10-10 15:42:24 +01:00
parent 59bb818f09
commit 9bddeb9324

View file

@ -507,7 +507,11 @@ void MPEKeyboardComponent::noteReleased (MPENote finishedNote)
void MPEKeyboardComponent::zoneLayoutChanged()
{
MessageManager::callAsync ([this] { updateZoneLayout(); });
MessageManager::callAsync ([ref = SafePointer<MPEKeyboardComponent> { this }]
{
if (ref != nullptr)
ref->updateZoneLayout();
});
}
} // namespace juce