From cf6066b36e57a79066e406d0c320c851d66c1bbf Mon Sep 17 00:00:00 2001 From: sgzed Date: Fri, 28 Jun 2024 12:43:56 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8D=E6=89=80=E6=9C=89P?= =?UTF-8?q?layer=E7=9A=84=E5=88=A0=E9=99=A4=E5=99=A8=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=90=8C=E4=B8=80=E4=B8=AA=E7=BA=BF=E7=A8=8B=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E6=9E=90=E6=9E=84=E5=AF=BC=E8=87=B4=E5=B4=A9=E6=BA=83=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#3672)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Player的删除器release_func是static类型,weak_poller不会更新了。后面析构使用的就不是正确的poller线程了。 --- src/Player/PlayerBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Player/PlayerBase.cpp b/src/Player/PlayerBase.cpp index abaa1311..9cc18f98 100644 --- a/src/Player/PlayerBase.cpp +++ b/src/Player/PlayerBase.cpp @@ -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 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; });