JUCE Assertion failure in juce_LookAndFeel.cpp:64 and AudioDeviceSelectorComponent

Hello all,

I’m not sure if there is a bug in the library? I made a custom LookAndFeel_V4 class and set it to MainComponent, which has an AudioDeviceSelectorComponent. The program exits without error if I just run and exit right away. but if I opened up the comboboxes in the AudioDeviceSelectorComponent before I exit, the lookandfeel destructor gives an assertion error because there is more than one active weak references:

jassert (masterReference.getNumActiveWeakReferences() == 0
|| (masterReference.getNumActiveWeakReferences() == 1
&& this == &getDefaultLookAndFeel()));

the number of active weak references is equal to the number of comboboxes i opened.

Thanks in advance

Did you follow the advice above the assertion?

Thanks for the reply! Yes I did read the comments. I called in the MainComponent constructors, similar to the tutorial for custom look and feel:

Setlookandfeel (& customlookandfeel);

Then in the destructor I called

Setlookandfeel (nullptr);

That worked for when I exit without clicking the combo boxes. But did not fix when I do click them and open menu pop-ups.

Am I missing some coding conventions?

Well then I guess this is telling you that your combo box is still open and using this L+F at the time you’re deleting it. You need to make sure the combo boxes are all cleaned up and not leaking.

I have the same problem (see LookAndFeel assert firing with ComboBoxPopup open).
The deconstructor of my ComboBoxe is called before the assertion fires, so they should be taken care of. However, the hidePopup() method within the deconstructor does not do the trick and the LaF is still referenced.

hello danielrudrich! yes i have read your thread

thanks jules and danielrudrich, i got it fixed. the problem was that the lookandfeel was destructed before the audiodeviceselectorcomponent. so i moved my lookandfeel to the first of the private fields and then the errors were gone (destructors start from the bottom to the top).

1 Like