FIX: [STUDIO-1033] rm webview script handler on webview destory
Change-Id: If1465ba6bf997bf17b8a33bc33d0f20d34fcbdc7
This commit is contained in:
parent
db65fd6e83
commit
9f3a89320b
4 changed files with 14 additions and 10 deletions
|
@ -2349,7 +2349,7 @@ void MainFrame::init_menubar_as_editor()
|
|||
// }
|
||||
// case ConfigMenuPreferences:
|
||||
// {
|
||||
// wxGetApp().CallAfter([this] {
|
||||
// CallAfter([this] {
|
||||
// PreferencesDialog dlg(this);
|
||||
// dlg.ShowModal();
|
||||
//#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
||||
|
@ -2386,7 +2386,7 @@ void MainFrame::init_menubar_as_editor()
|
|||
// Slic3r::GUI::about();
|
||||
// break;
|
||||
// case BambuStudioMenuPreferences:
|
||||
// wxGetApp().CallAfter([this] {
|
||||
// CallAfter([this] {
|
||||
// PreferencesDialog dlg(this);
|
||||
// dlg.ShowModal();
|
||||
//#if ENABLE_GCODE_LINES_ID_IN_H_SLIDER
|
||||
|
@ -3030,7 +3030,7 @@ void MainFrame::open_recent_project(size_t file_id, wxString const & filename)
|
|||
file_id = m_recent_projects.FindFileInHistory(filename);
|
||||
}
|
||||
if (wxFileExists(filename)) {
|
||||
wxGetApp().CallAfter([this, filename] {
|
||||
CallAfter([this, filename] {
|
||||
if (wxGetApp().can_load_project())
|
||||
m_plater->load_project(filename);
|
||||
});
|
||||
|
|
|
@ -311,7 +311,7 @@ void MediaPlayCtrl::ToggleStream()
|
|||
{ return std::make_shared<UpgradeNetworkJob2>(pri); }
|
||||
void on_finish() override
|
||||
{
|
||||
wxGetApp().CallAfter([ctrl = this->ctrl] { ctrl->ToggleStream(); });
|
||||
ctrl->CallAfter([ctrl = this->ctrl] { ctrl->ToggleStream(); });
|
||||
EndModal(wxID_CLOSE);
|
||||
}
|
||||
};
|
||||
|
@ -585,7 +585,7 @@ void wxMediaCtrl2::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||
if (maxHeight != GetMaxHeight()) {
|
||||
// BOOST_LOG_TRIVIAL(info) << "wxMediaCtrl2::DoSetSize: width: " << width << ", height: " << height << ", maxHeight: " << maxHeight;
|
||||
SetMaxSize({-1, maxHeight});
|
||||
Slic3r::GUI::wxGetApp().CallAfter([this] {
|
||||
CallAfter([this] {
|
||||
if (auto p = GetParent()) {
|
||||
p->Layout();
|
||||
p->Refresh();
|
||||
|
|
|
@ -180,14 +180,18 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
|
|||
Slic3r::GUI::WKWebView_setTransparentBackground(wkWebView);
|
||||
#endif
|
||||
#ifndef __WIN32__
|
||||
Slic3r::GUI::wxGetApp().CallAfter([webView] {
|
||||
webView->CallAfter([webView] {
|
||||
#endif
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": begin to add script message handler for wx.";
|
||||
Slic3r::GUI::wxGetApp().set_adding_script_handler(true);
|
||||
webView->Bind(wxEVT_DESTROY, [webView] (auto & e) {
|
||||
webView->RemoveScriptMessageHandler("wx");
|
||||
});
|
||||
if (!webView->AddScriptMessageHandler("wx"))
|
||||
wxLogError("Could not add script message handler");
|
||||
Slic3r::GUI::wxGetApp().set_adding_script_handler(false);
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": finished add script message handler for wx.";
|
||||
|
||||
#ifndef __WIN32__
|
||||
});
|
||||
#endif
|
||||
|
|
|
@ -43,7 +43,7 @@ void wxMediaCtrl2::Load(wxURI url)
|
|||
{
|
||||
#ifdef __WIN32__
|
||||
if (m_imp == nullptr) {
|
||||
Slic3r::GUI::wxGetApp().CallAfter([] {
|
||||
CallAfter([] {
|
||||
auto res = wxMessageBox(_L("Windows Media Player is required for this task! Do you want to enable 'Windows Media Player' for your operation system?"), _L("Error"), wxOK | wxCANCEL);
|
||||
if (res == wxOK) {
|
||||
wxString url = IsWindows10OrGreater()
|
||||
|
@ -73,7 +73,7 @@ void wxMediaCtrl2::Load(wxURI url)
|
|||
boost::filesystem::path data_dir_path(data_dir_str);
|
||||
auto dll_path = data_dir_path / "plugins" / "BambuSource.dll";
|
||||
if (boost::filesystem::exists(dll_path)) {
|
||||
Slic3r::GUI::wxGetApp().CallAfter(
|
||||
CallAfter(
|
||||
[dll_path] {
|
||||
int res = wxMessageBox(_L("BambuSource has not correctly been registered for media playing! Press Yes to re-register it."), _L("Error"), wxYES_NO);
|
||||
if (res == wxYES) {
|
||||
|
@ -82,7 +82,7 @@ void wxMediaCtrl2::Load(wxURI url)
|
|||
}
|
||||
});
|
||||
} else {
|
||||
Slic3r::GUI::wxGetApp().CallAfter([] {
|
||||
CallAfter([] {
|
||||
wxMessageBox(_L("Missing BambuSource component registered for media playing! Please re-install BambuStutio or seek after-sales help."), _L("Error"), wxOK);
|
||||
});
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ void wxMediaCtrl2::Load(wxURI url)
|
|||
}
|
||||
|
||||
if (!hasplugins) {
|
||||
Slic3r::GUI::wxGetApp().CallAfter([] {
|
||||
CallAfter([] {
|
||||
wxMessageBox(_L("Your system is missing H.264 codecs for GStreamer, which are required to play video. (Try installing the gstreamer1.0-plugins-bad or gstreamer1.0-libav packages, then restart Bambu Studio?)"), _L("Error"), wxOK);
|
||||
});
|
||||
m_error = 101;
|
||||
|
|
Loading…
Reference in a new issue