mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-26 01:28:37 -07:00
FIX: MediaPlayCtrl maybe deleted
jira: [STUDIO-12622] Change-Id: I9ee879c5bd046c9b3e1d33c96b7e3db9c9b35153 (cherry picked from commit 862fb9b53d3cda87135b93f5365608e22fc04411)
This commit is contained in:
parent
296bbe3dd6
commit
73dd707d7b
2 changed files with 11 additions and 1 deletions
|
|
@ -140,6 +140,8 @@ MediaPlayCtrl::~MediaPlayCtrl()
|
|||
while (!m_thread.try_join_for(boost::chrono::milliseconds(10))) {
|
||||
wxEventLoopBase::GetActive()->Yield();
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": " << this;
|
||||
}
|
||||
|
||||
void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
|
||||
|
|
@ -335,7 +337,12 @@ void MediaPlayCtrl::Play()
|
|||
if (agent) {
|
||||
std::string protocols[] = {"", "\"tutk\"", "\"agora\"", "\"tutk\",\"agora\""};
|
||||
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:///")) {
|
||||
url += "&device=" + into_u8(m);
|
||||
url += "&net_ver=" + v;
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ private:
|
|||
static const wxMediaState MEDIASTATE_LOADING = (wxMediaState) 5;
|
||||
static const wxMediaState MEDIASTATE_BUFFERING = (wxMediaState) 6;
|
||||
|
||||
// token
|
||||
std::shared_ptr<int> m_token = std::make_shared<int>(0);
|
||||
|
||||
wxMediaCtrl2 * m_media_ctrl;
|
||||
wxMediaState m_last_state = MEDIASTATE_IDLE;
|
||||
std::string m_machine;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue