1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed a potential crash in DropShadower when the component is deleted before the shadower

This commit is contained in:
ed 2021-04-22 16:13:36 +01:00
parent 8a2c6ad8f7
commit 547dc7712c
2 changed files with 6 additions and 9 deletions

View file

@ -76,10 +76,7 @@ private:
//==============================================================================
DropShadower::DropShadower (const DropShadow& ds)
: owner (nullptr), shadow (ds), reentrant (false)
{
}
DropShadower::DropShadower (const DropShadow& ds) : shadow (ds) {}
DropShadower::~DropShadower()
{
@ -91,7 +88,7 @@ DropShadower::~DropShadower()
updateParent();
reentrant = true;
const ScopedValueSetter<bool> setter (reentrant, true);
shadowWindows.clear();
}
@ -163,7 +160,7 @@ void DropShadower::updateShadows()
if (reentrant)
return;
const ScopedValueSetter<bool> setter (reentrant, true, false);
const ScopedValueSetter<bool> setter (reentrant, true);
if (owner == nullptr)
{
@ -209,7 +206,7 @@ void DropShadower::updateShadows()
if (sw == nullptr)
return;
sw->toBehind (i == 3 ? owner : shadowWindows.getUnchecked (i + 1));
sw->toBehind (i == 3 ? owner.get() : shadowWindows.getUnchecked (i + 1));
}
}
}

View file

@ -60,10 +60,10 @@ private:
//==============================================================================
class ShadowWindow;
Component* owner;
WeakReference<Component> owner;
OwnedArray<Component> shadowWindows;
DropShadow shadow;
bool reentrant;
bool reentrant = false;
WeakReference<Component> lastParentComp;
void componentMovedOrResized (Component&, bool, bool) override;