mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
bugfix: 修复所有Player的删除器使用同一个线程进行析构导致崩溃的问题 (#3672)
Player的删除器release_func是static类型,weak_poller不会更新了。后面析构使用的就不是正确的poller线程了。
This commit is contained in:
parent
5a717186dd
commit
cf6066b36e
@ -24,7 +24,7 @@ namespace mediakit {
|
||||
PlayerBase::Ptr PlayerBase::createPlayer(const EventPoller::Ptr &in_poller, const string &url_in) {
|
||||
auto poller = in_poller ? in_poller : EventPollerPool::Instance().getPoller();
|
||||
std::weak_ptr<EventPoller> weak_poller = poller;
|
||||
static auto release_func = [weak_poller](PlayerBase *ptr) {
|
||||
auto release_func = [weak_poller](PlayerBase *ptr) {
|
||||
if (auto poller = weak_poller.lock()) {
|
||||
poller->async([ptr]() {
|
||||
onceToken token(nullptr, [&]() { delete ptr; });
|
||||
|
Loading…
Reference in New Issue
Block a user