From 25d3a7f89d70d3f3b5eb3e6b9cc14dfc3612f75d Mon Sep 17 00:00:00 2001 From: jules Date: Fri, 15 Dec 2017 09:15:15 +0000 Subject: [PATCH] Added more comments to a LookAndFeel assertion that seems to be confusing people --- .../lookandfeel/juce_LookAndFeel.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp index d5d8b769fa..a364b2b7be 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp @@ -50,10 +50,18 @@ LookAndFeel::LookAndFeel() 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 code + /* This assertion is triggered if you try to delete a LookAndFeel object while something + is still using it! + + Reasons may be: + - it's still being used as the default LookAndFeel; or + - it's set as a Component's current lookandfeel; or + - there's a WeakReference to it somewhere else in your code + + Generally the fix for this will be to make sure you call + Component::setDefaultLookandFeel (nullptr) on any components that were still using + it before you delete it. Or call LookAndFeel::setDefaultLookAndFeel (nullptr) if you + had set it up to be the default one. Deleting 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,