godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.64k stars 496 forks source link

Class instance variables scope clarification #244

Open m4gr3d opened 5 years ago

m4gr3d commented 5 years ago

While going through the 'Dodge the creeps!' tutorial in C++, I noticed that signals' callbacks don't seem to observe changes made to a class instance variable:

Hud::is_game_over is updated in Hud::show_game_over, yet when the Hud::on_MessageTimer_timeout callback is fired, the updated value of Hud::is_game_over is not reflected.

I validated that the callback is happening to the same object and on the same thread as when the instance variable is updated.

This is probably not a bug, and most likely just some clarifications are needed to explain why that behavior is observed (if that's the expected behavior).

m4gr3d commented 5 years ago

@BastiaanOlij Any idea is this is the expected behavior?