Juce 6.1.6 last develop version as of today.
Adding ComboBoxes as custom components to a ListBox (very similar to the example in the DemoRunner) generates leaks of ComboBoxAccessibilityHandler.
What am I doing wrong?
The original function in the DemoRunner example has something like this:
Component* refreshComponentForCell(int rowNumber, int columnId, bool isRowSelected, Component* existingComponentToUpdate) override
{
// The other columns are editable text columns, for which we use the custom Label component
auto* textLabel = static_cast<EditableTextCustomComponent*> (existingComponentToUpdate);
// same as above...
if (textLabel == nullptr)
textLabel = new EditableTextCustomComponent(*this);
textLabel->setColour(Label::textColourId, isRowSelected && AllowSelection ? Colours::black : Colours::white);
textLabel->setRowAndColumn(rowNumber, columnId);
return textLabel;
}
I’m just changing the EditableTextCustomComponent
with a ComboBox
like this:
Component* refreshComponentForCell(int rowNumber, int columnId, bool isRowSelected, Component* existingComponentToUpdate) override
{
auto* cmb = static_cast<ComboBox*> (existingComponentToUpdate);
if (cmb == nullptr)
{
cmb = new ComboBox();
cmb->addItem("The Good", 1);
cmb->addItem("The Bad", 2);
cmb->addItem("The Ugly", 3);
return cmb;
}
return nullptr;
}
When the application exits I get
*** Leaked objects detected: X instance(s) of class ComboBoxAccessibilityHandler