mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-05 14:51:06 +00:00
fix: Home start shows Prepare or a blank window, and Prepare opens slowly (#15878)
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <wx/webviewarchivehandler.h>
|
||||
#include <wx/webviewfshandler.h>
|
||||
#include <wx/weakref.h>
|
||||
#if wxUSE_WEBVIEW_EDGE
|
||||
#include <wx/msw/webview_edge.h>
|
||||
#elif defined(__WXMAC__)
|
||||
@@ -235,7 +236,9 @@ class FakeWebView : public wxWebView
|
||||
wxDEFINE_EVENT(EVT_WEBVIEW_RECREATED, wxCommandEvent);
|
||||
|
||||
static std::vector<wxWebView*> g_webviews;
|
||||
static std::vector<wxWebView*> g_delay_webviews;
|
||||
// Webviews waiting for their script handler while another one is added; adding it yields, so a
|
||||
// view can be destroyed while it waits.
|
||||
static std::vector<wxWeakRef<wxWebView>> g_delay_webviews;
|
||||
|
||||
class WebViewRef : public wxObjectRefData
|
||||
{
|
||||
@@ -340,8 +343,9 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
|
||||
addScriptMessageHandler(webView);
|
||||
while (!g_delay_webviews.empty()) {
|
||||
auto views = std::move(g_delay_webviews);
|
||||
for (auto wv : views)
|
||||
addScriptMessageHandler(wv);
|
||||
for (const wxWeakRef<wxWebView>& wv : views)
|
||||
if (wv)
|
||||
addScriptMessageHandler(wv.get());
|
||||
}
|
||||
}
|
||||
#ifndef __WIN32__
|
||||
|
||||
Reference in New Issue
Block a user