mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-11 06:23:08 +00:00
fix linux slice crash question
This commit is contained in:
@@ -205,6 +205,9 @@ void PresetComboBox::update_selection()
|
||||
|
||||
// A workaround for a set of issues related to text fitting into gtk widgets:
|
||||
#if defined(__WXGTK20__) || defined(__WXGTK3__)
|
||||
// Guard: m_widget may not be a GtkCellLayout (e.g. not yet realized, or GtkComboBoxText in Flatpak/GTK3)
|
||||
if (!m_widget || !GTK_IS_CELL_LAYOUT(m_widget))
|
||||
return;
|
||||
GList* cells = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(m_widget));
|
||||
|
||||
// 'cells' contains the GtkCellRendererPixBuf for the icon,
|
||||
|
||||
@@ -275,10 +275,19 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
|
||||
// And the memory: file system
|
||||
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
|
||||
#else
|
||||
// With WKWebView handlers need to be registered before creation
|
||||
// Handlers must be registered before Create(). Linux (WebKit2): scheme is process-global, register once to avoid "Cannot register URI scheme ... more than once".
|
||||
// macOS (WKWebView): scheme is per-view, each WebView needs its own handlers.
|
||||
#if defined(__linux__)
|
||||
static bool s_wxfs_memory_handlers_registered = false;
|
||||
if (!s_wxfs_memory_handlers_registered) {
|
||||
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs")));
|
||||
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
|
||||
s_wxfs_memory_handlers_registered = true;
|
||||
}
|
||||
#else
|
||||
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs")));
|
||||
// And the memory: file system
|
||||
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
|
||||
#endif
|
||||
webView->Create(parent, wxID_ANY, url2, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||
webView->SetUserAgent(wxString::Format("SM-Slicer/v%s (%s) Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)", SLIC3R_VERSION,
|
||||
Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light"));
|
||||
|
||||
Reference in New Issue
Block a user