Skip to content

Commit

Permalink
Merge pull request #255 from limbonaut/fix-setting-bt-crash
Browse files Browse the repository at this point in the history
Fix: Keep `BTInstance` alive until update is finished (fixes #254)
  • Loading branch information
limbonaut authored Dec 4, 2024
2 parents 6644f19 + 23a6e5f commit 9cfdabc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions bt/bt_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 9cfdabc

Please sign in to comment.