Alternative to capture this in lambda [C++]
<p>I know if I have to call member functions in lambda for callbacks, I capture this in lambda and it works well.
But I have seen some crash recently and it appears that the member function is accessed after the object pointed to by this is already destroyed.
In nutshell, in shutdown the object is destroyed, but the pointer was passed around in lambda, which is accessed and results in crash.</p>

<p>So, I was trying to understand what the community generally do in such a case. I could not find much to this but I think shared_ptr could be an option.</p>

<p>Any suggestions/leads would be appreciated to help me understand and implement an alternative.</p>