mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixed a potential double deletion in ComponentAnimator::AnimationTask
This commit is contained in:
parent
147bbef730
commit
971fc8e589
1 changed files with 10 additions and 5 deletions
|
|
@ -32,6 +32,11 @@ class ComponentAnimator::AnimationTask
|
|||
public:
|
||||
AnimationTask (Component* c) noexcept : component (c) {}
|
||||
|
||||
~AnimationTask()
|
||||
{
|
||||
proxy.deleteAndZero();
|
||||
}
|
||||
|
||||
void reset (const Rectangle<int>& finalBounds,
|
||||
float finalAlpha,
|
||||
int millisecondsToSpendMoving,
|
||||
|
|
@ -58,17 +63,17 @@ public:
|
|||
midSpeed = invTotalDistance;
|
||||
endSpeed = jmax (0.0, endSpd * invTotalDistance);
|
||||
|
||||
proxy.deleteAndZero();
|
||||
|
||||
if (useProxyComponent)
|
||||
proxy.reset (new ProxyComponent (*component));
|
||||
else
|
||||
proxy.reset();
|
||||
proxy = new ProxyComponent (*component);
|
||||
|
||||
component->setVisible (! useProxyComponent);
|
||||
}
|
||||
|
||||
bool useTimeslice (const int elapsed)
|
||||
{
|
||||
if (auto* c = proxy != nullptr ? proxy.get()
|
||||
if (auto* c = proxy != nullptr ? proxy.getComponent()
|
||||
: component.get())
|
||||
{
|
||||
msElapsed += elapsed;
|
||||
|
|
@ -182,7 +187,7 @@ public:
|
|||
};
|
||||
|
||||
WeakReference<Component> component;
|
||||
std::unique_ptr<Component> proxy;
|
||||
Component::SafePointer<Component> proxy;
|
||||
|
||||
Rectangle<int> destination;
|
||||
double destAlpha;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue