Juce - xCode - setLookAndFeel - error

I work with Projucer (Juce v5.2.0) and xCode 9.2 and I have some strange error when I use setLookAndFeel on Slider.

I go step by step with that tutorial: https://www.youtube.com/watch?v=po46y8UKPOY&t=1020s

And I make exactly the same code. On the video there is no problem. My error appear when I compile the same code as it’s in the 17:13 duration of the movie.

My problem is: when I compile the code everything is OK, my compiled app works great, “setLookAndFeel” works as expect. But the problem is when I close app. Then app looks like closed, but the icon is on the dock, and xCode shows “Stop” button active, so it looks like my app still works in some way. And xCode takes me automatically to something called “Juce Massage Thread (1)” and there is error:
Juce Message Thread (1): EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0

It’s next to that code:

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

Could anyone help me? Thanks in advance.

See: LookAndFeel assert firing on 5.2 quit
You have to unset your lookAndFeel-methods as they get deleted when closing the app. Put setLookAndFeel(nullptr); into your editor’s (or component’s) destructor.

Hello,
thanks for your reply, I also thought it’s something with that.
But unfortunately it doesn’t help. Bet even if it would help, it’s still strange on the tutorial video there is no problem like that, guy on the video doesn’t delete any memory allocation so why should I?

The code has changed since the tutorial was put out.

Hello,
I am sorry, the delate of allocated memory helped. First time I made it wrong. Now it works.
I needed to write:
dur1.setLookAndFeel(nullptr);

where “dur1” is my variable of LookAndFeel_V4.

Thanks for your help.
Best Regards