mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-18 04:25:56 +08:00
FIX: gui: fix the crash issue when close guide frame at the beginning
jira: STUDIO-9941 Change-Id: I47e189e838ae606d294d0c0b4ccffc6f833a27c3 (cherry picked from commit 093a7c25cb7507d0d6af228c2efa3410e1184c27)
This commit is contained in:
parent
5e79e9196f
commit
cf0c5624a1
@ -187,6 +187,12 @@ GuideFrame::GuideFrame(GUI_App *pGUI, long style)
|
|||||||
|
|
||||||
GuideFrame::~GuideFrame()
|
GuideFrame::~GuideFrame()
|
||||||
{
|
{
|
||||||
|
m_destroy = true;
|
||||||
|
if (m_load_task && m_load_task->joinable()) {
|
||||||
|
m_load_task->join();
|
||||||
|
delete m_load_task;
|
||||||
|
m_load_task = nullptr;
|
||||||
|
}
|
||||||
if (m_browser) {
|
if (m_browser) {
|
||||||
delete m_browser;
|
delete m_browser;
|
||||||
m_browser = nullptr;
|
m_browser = nullptr;
|
||||||
@ -296,8 +302,9 @@ void GuideFrame::OnNavigationComplete(wxWebViewEvent &evt)
|
|||||||
{
|
{
|
||||||
//wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'");
|
//wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'");
|
||||||
if (!bFirstComplete) {
|
if (!bFirstComplete) {
|
||||||
boost::thread LoadProfileThread(boost::bind(&GuideFrame::LoadProfileData, this));
|
m_load_task = new boost::thread(boost::bind(&GuideFrame::LoadProfileData, this));
|
||||||
LoadProfileThread.detach();
|
// boost::thread LoadProfileThread(boost::bind(&GuideFrame::LoadProfileData, this));
|
||||||
|
//LoadProfileThread.detach();
|
||||||
|
|
||||||
bFirstComplete = true;
|
bFirstComplete = true;
|
||||||
}
|
}
|
||||||
@ -1028,6 +1035,8 @@ int GuideFrame::LoadProfileData()
|
|||||||
LoadProfileFamily(w2s(strVendor), iter->path().string());
|
LoadProfileFamily(w2s(strVendor), iter->path().string());
|
||||||
loaded_vendors.insert(w2s(strVendor));
|
loaded_vendors.insert(w2s(strVendor));
|
||||||
}
|
}
|
||||||
|
if (m_destroy)
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::filesystem::directory_iterator others_endIter;
|
boost::filesystem::directory_iterator others_endIter;
|
||||||
@ -1043,6 +1052,8 @@ int GuideFrame::LoadProfileData()
|
|||||||
LoadProfileFamily(w2s(strVendor), iter->path().string());
|
LoadProfileFamily(w2s(strVendor), iter->path().string());
|
||||||
loaded_vendors.insert(w2s(strVendor));
|
loaded_vendors.insert(w2s(strVendor));
|
||||||
}
|
}
|
||||||
|
if (m_destroy)
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//sync to web
|
//sync to web
|
||||||
@ -1053,9 +1064,11 @@ int GuideFrame::LoadProfileData()
|
|||||||
m_Res["command"] = "userguide_profile_load_finish";
|
m_Res["command"] = "userguide_profile_load_finish";
|
||||||
m_Res["sequence_id"] = "10001";
|
m_Res["sequence_id"] = "10001";
|
||||||
wxString strJS = wxString::Format("HandleStudio(%s)", m_Res.dump(-1, ' ', true));
|
wxString strJS = wxString::Format("HandleStudio(%s)", m_Res.dump(-1, ' ', true));
|
||||||
|
if (!m_destroy)
|
||||||
wxGetApp().CallAfter([this, strJS] { RunScript(strJS); });
|
wxGetApp().CallAfter([this, strJS] { RunScript(strJS); });
|
||||||
|
|
||||||
//sync to appconfig
|
//sync to appconfig
|
||||||
|
if (!m_destroy)
|
||||||
wxGetApp().CallAfter([this] { SaveProfileData(); });
|
wxGetApp().CallAfter([this] { SaveProfileData(); });
|
||||||
|
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
|
@ -110,6 +110,8 @@ private:
|
|||||||
|
|
||||||
//First Load
|
//First Load
|
||||||
bool bFirstComplete{false};
|
bool bFirstComplete{false};
|
||||||
|
bool m_destroy{false};
|
||||||
|
boost::thread* m_load_task{ nullptr };
|
||||||
|
|
||||||
// User Config
|
// User Config
|
||||||
bool PrivacyUse;
|
bool PrivacyUse;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user