FIX: gui: fix the crash issue when close guide frame at the beginning
jira: STUDIO-9941 Change-Id: I47e189e838ae606d294d0c0b4ccffc6f833a27c3
This commit is contained in:
parent
da0fe0b4e2
commit
093a7c25cb
|
@ -182,6 +182,12 @@ GuideFrame::GuideFrame(GUI_App *pGUI, long style)
|
|||
|
||||
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) {
|
||||
delete m_browser;
|
||||
m_browser = nullptr;
|
||||
|
@ -291,8 +297,9 @@ void GuideFrame::OnNavigationComplete(wxWebViewEvent &evt)
|
|||
{
|
||||
//wxLogMessage("%s", "Navigation complete; url='" + evt.GetURL() + "'");
|
||||
if (!bFirstComplete) {
|
||||
boost::thread LoadProfileThread(boost::bind(&GuideFrame::LoadProfileData, this));
|
||||
LoadProfileThread.detach();
|
||||
m_load_task = new boost::thread(boost::bind(&GuideFrame::LoadProfileData, this));
|
||||
// boost::thread LoadProfileThread(boost::bind(&GuideFrame::LoadProfileData, this));
|
||||
//LoadProfileThread.detach();
|
||||
|
||||
bFirstComplete = true;
|
||||
}
|
||||
|
@ -1103,6 +1110,8 @@ int GuideFrame::LoadProfileData()
|
|||
|
||||
if (w2s(strVendor) == PresetBundle::BBL_BUNDLE && strExtension.CmpNoCase("json") == 0) LoadProfileFamily(w2s(strVendor), iter->path().string());
|
||||
}
|
||||
if (m_destroy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// string others_targetPath = rsrc_vendor_dir.string();
|
||||
|
@ -1121,6 +1130,8 @@ int GuideFrame::LoadProfileData()
|
|||
|
||||
if (w2s(strVendor) != PresetBundle::BBL_BUNDLE && strExtension.CmpNoCase("json") == 0) LoadProfileFamily(w2s(strVendor), iter->path().string());
|
||||
}
|
||||
if (m_destroy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//sync to web
|
||||
|
@ -1131,12 +1142,14 @@ int GuideFrame::LoadProfileData()
|
|||
m_Res["command"] = "userguide_profile_load_finish";
|
||||
m_Res["sequence_id"] = "10001";
|
||||
wxString strJS = wxString::Format("HandleStudio(%s)", m_Res.dump(-1, ' ', true));
|
||||
wxGetApp().CallAfter([this, strJS] { RunScript(strJS); });
|
||||
if (!m_destroy)
|
||||
wxGetApp().CallAfter([this, strJS] { RunScript(strJS); });
|
||||
|
||||
//sync to appconfig
|
||||
wxGetApp().CallAfter([this] { SaveProfileData(); });
|
||||
if (!m_destroy)
|
||||
wxGetApp().CallAfter([this] { SaveProfileData(); });
|
||||
|
||||
} catch (std::exception &e) {
|
||||
} catch (std::exception& e) {
|
||||
// wxLogMessage("GUIDE: load_profile_error %s ", e.what());
|
||||
// wxMessageBox(e.what(), "", MB_OK);
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ", error: " << e.what() << std::endl;
|
||||
|
|
|
@ -110,6 +110,8 @@ private:
|
|||
|
||||
//First Load
|
||||
bool bFirstComplete{false};
|
||||
bool m_destroy{false};
|
||||
boost::thread* m_load_task{ nullptr };
|
||||
|
||||
// User Config
|
||||
bool PrivacyUse;
|
||||
|
|
Loading…
Reference in New Issue