FIX: MediaPlayCtrl crash on switch language

Change-Id: If69bd42f586e6e15387ffe387c820480cbf750dd
This commit is contained in:
chunmao.guo 2022-11-21 17:34:18 +08:00 committed by Lane.Wei
parent 30a473c977
commit 73242280ef
3 changed files with 15 additions and 8 deletions

View file

@ -59,13 +59,8 @@ MediaPlayCtrl::MediaPlayCtrl(wxWindow *parent, wxMediaCtrl2 *media_ctrl, const w
// m_next_retry = wxDateTime::Now();
//#endif
auto onShowHide = [this](auto &e) {
e.Skip();
if (m_isBeingDeleted) return;
IsShownOnScreen() ? Play() : Stop();
};
parent->Bind(wxEVT_SHOW, onShowHide);
parent->GetParent()->GetParent()->Bind(wxEVT_SHOW, onShowHide);
parent->Bind(wxEVT_SHOW, &MediaPlayCtrl::on_show_hide, this);
parent->GetParent()->GetParent()->Bind(wxEVT_SHOW, &MediaPlayCtrl::on_show_hide, this);
m_lan_user = "bblp";
m_lan_passwd = "bblp";
@ -387,6 +382,13 @@ void MediaPlayCtrl::SetStatus(wxString const &msg2, bool hyperlink)
bool MediaPlayCtrl::IsStreaming() const { return m_streaming; }
void MediaPlayCtrl::on_show_hide(wxShowEvent &evt)
{
evt.Skip();
if (m_isBeingDeleted) return;
IsShownOnScreen() ? Play() : Stop();
}
void MediaPlayCtrl::media_proc()
{
boost::unique_lock lock(m_mutex);