Use shared_from_this idiom correctly.