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

View file

@ -51,6 +51,8 @@ protected:
void SetStatus(wxString const &msg, bool hyperlink = true); void SetStatus(wxString const &msg, bool hyperlink = true);
private: private:
void on_show_hide(wxShowEvent & evt);
void media_proc(); void media_proc();
bool get_stream_url(std::string * url = nullptr); bool get_stream_url(std::string * url = nullptr);

View file

@ -158,7 +158,10 @@ StatusBasePanel::StatusBasePanel(wxWindow *parent, wxWindowID id, const wxPoint
this->Layout(); this->Layout();
} }
StatusBasePanel::~StatusBasePanel() { delete m_media_play_ctrl; } StatusBasePanel::~StatusBasePanel()
{
delete m_media_play_ctrl;
}
void StatusBasePanel::init_bitmaps() void StatusBasePanel::init_bitmaps()
{ {