fix build errors on Linux with Clang 20 and GTK warnings (#12507)

* guard -Wno-error=enum-constexpr-conversion behind compiler flag check

* Fix: Suppress GTK critical warnings and prevent multiple URI scheme registrations in WebView
This commit is contained in:
SoftFever
2026-03-01 18:43:15 +08:00
committed by GitHub
parent 04018980e1
commit b908bab904
4 changed files with 30 additions and 9 deletions

View File

@@ -2697,6 +2697,18 @@ bool GUI_App::on_init_inner()
g_object_set (gtk_settings_get_default (), "gtk-menu-images", TRUE, NULL);
#endif
#if defined(__WXGTK20__) || defined(__WXGTK3__)
// Suppress harmless GTK critical warnings from the GTK3/wxWidgets interaction.
// These include widget allocation on hidden widgets and events on unrealized widgets.
g_log_set_handler("Gtk", G_LOG_LEVEL_CRITICAL,
[](const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) {
if (message && (strstr(message, "gtk_widget_set_allocation") ||
strstr(message, "WIDGET_REALIZED_FOR_EVENT")))
return;
g_log_default_handler(log_domain, log_level, message, user_data);
}, nullptr);
#endif
#ifdef WIN32
//BBS set crash log folder
CBaseException::set_log_folder(data_dir());