# setDefaultLookAndFeel

**URL:** <https://forum.juce.com/t/setdefaultlookandfeel/5415>\
**Category:** Audio Plugins\
**Created:** [June 27, 2010, 3:39pm UTC](https://forum.juce.com/t/setdefaultlookandfeel/5415 "2010-06-27T15:39:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtw](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@mtw](https://forum.juce.com/u/mtw)\
**Post date:** [June 27, 2010, 3:39pm UTC](https://forum.juce.com/t/setdefaultlookandfeel/5415/1 "2010-06-27T15:39:37Z")

</div>

Hi,

I am hitting some crashes when loading then unloading multiple instances of my plugin.

As soon as I unload one instance, I get a crash both on VST (win, mac) and AU, although the behavior is slightly different on mac: I can move my mouse over the components, which are redrawn using the default L+F, and the crash occurs quickly afterwards.

I am pretty sure that it is due to me calling setDefaultLookAndFeel in my plugin’s constructor as I’m getting the same issue with the juce demo when throwing in a basic custom L+F and setting it as default.

I reckon it is not safe to use statics when multiple instances may be used, but should one just stay away from setDefaultLookAndFeel when making a plug-in or is there a way out?

Also, should I expect more “static” troubles once I’ve got rid of the look and feel problem?

Thank you for help!

---

<div class="post-metadata">

**Author:** ![chkn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/chkn/32/3862_2.png) [@chkn](https://forum.juce.com/u/chkn)\
**Post date:** [June 28, 2010, 7:35am UTC](https://forum.juce.com/t/setdefaultlookandfeel/5415/2 "2010-06-28T07:35:20Z")

</div>

use Singleton and DeletedAtShutdown

[http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=4642&hilit=lookandfeel+plugin](http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=4642&hilit=lookandfeel+plugin)

All you need is:

```auto
    class NewLook : public LookAndFeel, public DeletedAtShutdown
    {
        juce_DeclareSingleton (NewLook)
        etc...
    }

```

and then just call:

```auto

    LookAndFeel::setDefaultLookAndFeel (NewLook::getInstance())

```

…as often as you like.

---

<div class="post-metadata">

**Author:** ![mtw](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@mtw](https://forum.juce.com/u/mtw)\
**Post date:** [June 28, 2010, 9:25pm UTC](https://forum.juce.com/t/setdefaultlookandfeel/5415/3 "2010-06-28T21:25:48Z")

</div>

Damn, how could I miss this post… Thank you!
