You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Prevent errors if Tween callback's object is freed
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
[CallbackTweener] is used to call a method in a tweening sequence. See [method Tween.tween_callback] for more usage information.
|
[CallbackTweener] is used to call a method in a tweening sequence. See [method Tween.tween_callback] for more usage information.
|
||||||
|
The tweener will finish automatically if the callback's target object is freed.
|
||||||
[b]Note:[/b] [method Tween.tween_callback] is the only correct way to create [CallbackTweener]. Any [CallbackTweener] created manually will not function correctly.
|
[b]Note:[/b] [method Tween.tween_callback] is the only correct way to create [CallbackTweener]. Any [CallbackTweener] created manually will not function correctly.
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
[MethodTweener] is similar to a combination of [CallbackTweener] and [PropertyTweener]. It calls a method providing an interpolated value as a parameter. See [method Tween.tween_method] for more usage information.
|
[MethodTweener] is similar to a combination of [CallbackTweener] and [PropertyTweener]. It calls a method providing an interpolated value as a parameter. See [method Tween.tween_method] for more usage information.
|
||||||
|
The tweener will finish automatically if the callback's target object is freed.
|
||||||
[b]Note:[/b] [method Tween.tween_method] is the only correct way to create [MethodTweener]. Any [MethodTweener] created manually will not function correctly.
|
[b]Note:[/b] [method Tween.tween_method] is the only correct way to create [MethodTweener]. Any [MethodTweener] created manually will not function correctly.
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
|
|||||||
@@ -675,6 +675,10 @@ bool CallbackTweener::step(double &r_delta) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!callback.get_object()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
elapsed_time += r_delta;
|
elapsed_time += r_delta;
|
||||||
if (elapsed_time >= delay) {
|
if (elapsed_time >= delay) {
|
||||||
Variant result;
|
Variant result;
|
||||||
@@ -736,6 +740,10 @@ bool MethodTweener::step(double &r_delta) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!callback.get_object()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
elapsed_time += r_delta;
|
elapsed_time += r_delta;
|
||||||
|
|
||||||
if (elapsed_time < delay) {
|
if (elapsed_time < delay) {
|
||||||
|
|||||||
Reference in New Issue
Block a user