SMACC icon indicating copy to clipboard operation
SMACC copied to clipboard

Implement smart pointers and signals2 tracking

Open yassiezar opened this issue 1 year ago • 5 comments

This is an experimental branch to solve some of the issues we've been facing, described in #57 and #86

Basically, I've added the ability to gain access to clients from CBs as std::weak_ptrs rather than raw pointers. Since they were saved as std::shared_ptrs already within the state machine, it was a pretty straight-forward change.

The main change is using boost::signals2 tracking facility to automatically monitor and control a slot's lifetime based on when the owning CB goes out of scope. Early tests show that this might prevents the issue we've been facing where member variables are being access from a CB callback after the callback has been deallocated upon state transitions.

Both these changes have been integrated in a small part within the sm_ferrari example's CB if you wanted to see the intended usage

This is very much WIP and a lot needs to be refined. Opening up this PR for visibility and comments

┆Issue is synchronized with this Jira Task by Unito

yassiezar avatar Mar 27 '23 16:03 yassiezar