Fix: Keep `BTInstance` alive until update is finished

Fixes #254
This commit is contained in:
Serhii Snitsaruk 2024-12-04 17:48:23 +01:00
parent 6644f191ca
commit 23a6e5fdfe
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
1 changed files with 1 additions and 0 deletions

View File

@ -42,6 +42,7 @@ BT::Status BTInstance::update(double p_delta) {
double start = Time::get_singleton()->get_ticks_usec();
#endif
const Ref<BTInstance> keep_alive{ this }; // keep instance alive until update is finished
last_status = root_task->execute(p_delta);
emit_signal(LW_NAME(updated), last_status);