Slider PopupDisplayComponent bug


if a slider is destructed while its PopupDisplayComponent exists then we get a EXC_BAD_ACCESS in the PopupDisplayComponent destructor.

to reproduce :

  • open the demo runner -> widgetdemo -> sliders tab
  • hover the slider that is at the extreme right to see its PopupDisplayComponent
  • quit (cmd+q) the app while the PopupDisplayComponent is shown


Thanks, I’ll sort this out.


I have a derived Slider class with a L&F… and even though the LookAndFeel is declared as the first variable in the class and I have:

 setLookAndFeel (nullptr);

in the destructor… if I quit while the pimpl->popupDisplay is visible then I hit the ~LookAndFeel() assertion.



Adding the following lines to the destructor of your derived Slider should fix the issue:

if (auto* popup = getCurrentPopupDisplay())
    popup->setLookAndFeel (nullptr);


Thanks! Oddly enough it needs both…

    if (auto* popup = getCurrentPopupDisplay())
        popup->setLookAndFeel (nullptr);
    setLookAndFeel (nullptr);

Even though the L&F is the first class variable defined.




Yeah, it’s because the Slider and its PopupDisplayComponent hold a reference to the L&F and they are destroyed after your derived class which contains the L&F object.


That explains the refCount value of 2 I was seeing.