Follow-up from "Draft: Resolve "heap-use-after-free and invalid vptr on PingCheckMgr destruction""
The following discussion from !2197 (merged) should be addressed:
-
@andrei started a discussion: (+3 comments) To keep the members alive, they can be added to a lambda function which uses a smart pointer to capture the object, but does not use it. It then must be added to the IOService queue using the post function.
I would take the
shared_from_this
alternative anytime if it gets rid of the posts.If you think that it is too much work for now although it shouldn't be, we can create a ticket, but can you at least add comments to say that they are posted only for extending lifetime?
Core:
+ getIOService()->post(std::bind(f, queue_mgr_)); + io_service_->post(std::bind(f, timer_)); + io_service_->post(std::bind(f, timer_)); + io_service_->post(std::bind(f, timer_)); + io_service_->post(std::bind(f, timer_, tcp_socket_, tls_socket_));
Premium:
+ main_io_service_->post(std::bind(f, expiration_timer_, channel_));
Edited by Andrei Pavel