FIX: [STUDIO-2234] wxMediaCtrl2 Stop twice on macOS

Change-Id: I645ada1b00a6d43e29a743b8f83f39fa75481a63
This commit is contained in:
chunmao.guo 2023-02-10 18:43:23 +08:00 committed by Lane.Wei
parent bb53da59e7
commit 6a33848a6d
2 changed files with 8 additions and 1 deletions

View file

@ -40,6 +40,8 @@ protected:
void DoSetSize(int x, int y, int width, int height, int sizeFlags) override;
static void bambu_log(void const * ctx, int level, char const * msg);
void NotifyStopped();
private:
void create_player();

View file

@ -33,7 +33,7 @@ void wxMediaCtrl2::bambu_log(void const * ctx, int level, char const * msg)
}
} else if (level < 0) {
wxMediaCtrl2 * ctrl = (wxMediaCtrl2 *) ctx;
ctrl->Stop();
ctrl->NotifyStopped();
}
BOOST_LOG_TRIVIAL(info) << msg;
}
@ -129,6 +129,11 @@ void wxMediaCtrl2::Stop()
}
BambuPlayer * player2 = (BambuPlayer *) m_player;
[player2 close];
NotifyStopped();
}
void wxMediaCtrl2::NotifyStopped()
{
if (m_state != wxMEDIASTATE_STOPPED) {
m_state = wxMEDIASTATE_STOPPED;
wxMediaEvent event(wxEVT_MEDIA_STATECHANGED);