mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added an assertion that will be triggered at the moment you attempt to delete a LookAndFeel object that's still in use somewhere
This commit is contained in:
parent
bf64d88de8
commit
6db06f7a9a
2 changed files with 16 additions and 0 deletions
|
|
@ -126,6 +126,12 @@ public:
|
|||
addAndMakeVisible (demoList);
|
||||
}
|
||||
|
||||
~ContentComponent()
|
||||
{
|
||||
// before deleting our lookandfeel object, make sure it's no longer in use
|
||||
LookAndFeel::setDefaultLookAndFeel (nullptr);
|
||||
}
|
||||
|
||||
void clearCurrentDemo()
|
||||
{
|
||||
currentDemo = nullptr;
|
||||
|
|
|
|||
|
|
@ -50,6 +50,16 @@ 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
|
||||
|
||||
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,
|
||||
so it's advisable to clear up any references before destroying them!
|
||||
*/
|
||||
jassert (masterReference.getNumActiveWeakReferences() == 0);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue