ComboBoxAccessibilityHandler leaks

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

Trying with FilenameComponent I get the exact same assertion because FilenameComponent uses a ComboBox.

You should try with:

if (cmb == nullptr)

D’oh! That was a typo… You can also comment that if, the ComboBoxes are created anyway, but still you get the leakage error when the app quits.

If you continue after the first assertion, are any other components leaked?

Good point. I found what I was doing wrong. This function is called everytime the table has to be redrawn, so I have to understand whether the component for that cell has to be created (only the first time) or its pointer has to be returned. This explains why creating just one row did not trigger the leakage error. Thanks for your time.