mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 11:02:08 +00:00
FIX: MediaPlayCtrl maybe deleted
jira: [STUDIO-12622] Change-Id: I9ee879c5bd046c9b3e1d33c96b7e3db9c9b35153 (cherry picked from commit 862fb9b53d3cda87135b93f5365608e22fc04411)
This commit is contained in:
@@ -140,6 +140,8 @@ MediaPlayCtrl::~MediaPlayCtrl()
|
|||||||
while (!m_thread.try_join_for(boost::chrono::milliseconds(10))) {
|
while (!m_thread.try_join_for(boost::chrono::milliseconds(10))) {
|
||||||
wxEventLoopBase::GetActive()->Yield();
|
wxEventLoopBase::GetActive()->Yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": " << this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
||||||
@@ -335,7 +337,12 @@ void MediaPlayCtrl::Play()
|
|||||||
if (agent) {
|
if (agent) {
|
||||||
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
||||||
agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
|
agent->get_camera_url(m_machine + "|" + m_dev_ver + "|" + protocols[m_remote_proto],
|
||||||
[this, m = m_machine, v = agent_version, dv = m_dev_ver](std::string url) {
|
[this, m = m_machine, v = agent_version, dv = m_dev_ver, token = std::weak_ptr(m_token)](std::string url) {
|
||||||
|
if (token.expired()) {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": token has been expired";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
if (boost::algorithm::starts_with(url, "bambu:///")) {
|
||||||
url += "&device=" + into_u8(m);
|
url += "&device=" + into_u8(m);
|
||||||
url += "&net_ver=" + v;
|
url += "&net_ver=" + v;
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ private:
|
|||||||
static const wxMediaState MEDIASTATE_LOADING = (wxMediaState) 5;
|
static const wxMediaState MEDIASTATE_LOADING = (wxMediaState) 5;
|
||||||
static const wxMediaState MEDIASTATE_BUFFERING = (wxMediaState) 6;
|
static const wxMediaState MEDIASTATE_BUFFERING = (wxMediaState) 6;
|
||||||
|
|
||||||
|
// token
|
||||||
|
std::shared_ptr<int> m_token = std::make_shared<int>(0);
|
||||||
|
|
||||||
wxMediaCtrl2 * m_media_ctrl;
|
wxMediaCtrl2 * m_media_ctrl;
|
||||||
wxMediaState m_last_state = MEDIASTATE_IDLE;
|
wxMediaState m_last_state = MEDIASTATE_IDLE;
|
||||||
std::string m_machine;
|
std::string m_machine;
|
||||||
|
|||||||
Reference in New Issue
Block a user