Hi I am dealing with an issue where a custom LookAndFeel class I use in a plugin triggers a breakpoint when opening an the plugin editor.
LookAndFeel::~LookAndFeel()
{
/* This assertion is triggered if you try to delete a LookAndFeel object while it’s
- still being used as the default LookAndFeel; or
- is set as a Component’s current lookandfeel; or
- pointed to by a WeakReference somewhere else in the codeDeleting a LookAndFeel is unlikely to cause a crash since most things will use a safe WeakReference to it, but it could cause some unexpected graphical behaviour, so it's advisable to clear up any references before destroying them! */ jassert (masterReference.getNumActiveWeakReferences() == 0 || (masterReference.getNumActiveWeakReferences() == 1 && this == &getDefaultLookAndFeel()));}
Clearly the reference to the LookAndFeel class which I am giving my sliders needs to be cleared somehow in the destructor. I solved this issue by adding:
mySlider.setLookAndFeel(&LookAndFeel::getDefaultLookAndFeel());
To the AudioProcessorEditor destructor, but this seems kind of hacky. What is the best practice way to do this? I am passing the look in feel reference to my sliders as described in the JUCE tutorial here:
mySlider.setLookAndFeel (&myCustomLookAndFeel);
