1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Blocks: lazy load LEDRow to avoid blocks being cleared at the wrong time

This commit is contained in:
dimitriroli 2018-10-18 15:58:10 +01:00 committed by Julian Storer
parent 255a66a1b8
commit d69771403e
2 changed files with 9 additions and 5 deletions

View file

@ -151,7 +151,7 @@ public:
neither delete it or use it after the lifetime of this Block object has finished.
If there are no LEDs, then this method will return nullptr.
*/
virtual LEDRow* getLEDRow() const = 0;
virtual LEDRow* getLEDRow() = 0;
/** If this block has any status LEDs, this will return an array of objects to control them.
Note that the objects in the array belong to this Block object, and the caller must

View file

@ -1470,9 +1470,6 @@ struct PhysicalTopologySource::Internal
for (auto&& s : modelData.statusLEDs)
statusLights.add (new StatusLightImplementation (*this, s));
if (modelData.numLEDRowLEDs > 0)
ledRow.reset (new LEDRowImplementation (*this));
updateMidiConnectionListener();
}
@ -1546,7 +1543,14 @@ struct PhysicalTopologySource::Internal
TouchSurface* getTouchSurface() const override { return touchSurface.get(); }
LEDGrid* getLEDGrid() const override { return ledGrid.get(); }
LEDRow* getLEDRow() const override { return ledRow.get(); }
LEDRow* getLEDRow() override
{
if (ledRow == nullptr && modelData.numLEDRowLEDs > 0)
ledRow.reset (new LEDRowImplementation (*this));
return ledRow.get();
}
juce::Array<ControlButton*> getButtons() const override
{