fix: potential crash caused by dlopen different gtk libraries (#33650)
This commit is contained in:
parent
9d4aceb940
commit
37b7e347fc
15 changed files with 130 additions and 183 deletions
|
@ -61,7 +61,6 @@ feat_enable_offscreen_rendering_with_viz_compositor.patch
|
|||
gpu_notify_when_dxdiag_request_fails.patch
|
||||
feat_allow_embedders_to_add_observers_on_created_hunspell.patch
|
||||
feat_add_onclose_to_messageport.patch
|
||||
ui_gtk_public_header.patch
|
||||
allow_in-process_windows_to_have_different_web_prefs.patch
|
||||
refactor_expose_cursor_changes_to_the_webcontentsobserver.patch
|
||||
crash_allow_setting_more_options.patch
|
||||
|
@ -108,3 +107,4 @@ build_disable_partition_alloc_on_mac.patch
|
|||
fix_non-client_mouse_tracking_and_message_bubbling_on_windows.patch
|
||||
build_make_libcxx_abi_unstable_false_for_electron.patch
|
||||
introduce_ozoneplatform_electron_can_call_x11_property.patch
|
||||
make_gtk_getlibgtk_public.patch
|
||||
|
|
52
patches/chromium/make_gtk_getlibgtk_public.patch
Normal file
52
patches/chromium/make_gtk_getlibgtk_public.patch
Normal file
|
@ -0,0 +1,52 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Thu, 7 Apr 2022 20:30:16 +0900
|
||||
Subject: Make gtk::GetLibGtk public
|
||||
|
||||
Allows embedders to get a handle to the gtk library
|
||||
already loaded in the process.
|
||||
|
||||
diff --git a/ui/gtk/gtk_compat.cc b/ui/gtk/gtk_compat.cc
|
||||
index 7104a0d5f4489c687f3cb9e63bc7cbef59d2fa62..f0b9ed834a3f7310da09377f0b2105cf635ffeb7 100644
|
||||
--- a/ui/gtk/gtk_compat.cc
|
||||
+++ b/ui/gtk/gtk_compat.cc
|
||||
@@ -86,12 +86,6 @@ void* GetLibGtk4(bool check = true) {
|
||||
return libgtk4;
|
||||
}
|
||||
|
||||
-void* GetLibGtk() {
|
||||
- if (GtkCheckVersion(4))
|
||||
- return GetLibGtk4();
|
||||
- return GetLibGtk3();
|
||||
-}
|
||||
-
|
||||
bool LoadGtk3() {
|
||||
if (!GetLibGtk3(false))
|
||||
return false;
|
||||
@@ -133,6 +127,12 @@ gfx::Insets InsetsFromGtkBorder(const GtkBorder& border) {
|
||||
|
||||
} // namespace
|
||||
|
||||
+void* GetLibGtk() {
|
||||
+ if (GtkCheckVersion(4))
|
||||
+ return GetLibGtk4();
|
||||
+ return GetLibGtk3();
|
||||
+}
|
||||
+
|
||||
bool LoadGtk() {
|
||||
static bool loaded = LoadGtkImpl();
|
||||
return loaded;
|
||||
diff --git a/ui/gtk/gtk_compat.h b/ui/gtk/gtk_compat.h
|
||||
index 72981270fe26579211afcaf3c596a412f69f5fac..b5dbfde5b011d57d26960d245e0dc61cac9341e4 100644
|
||||
--- a/ui/gtk/gtk_compat.h
|
||||
+++ b/ui/gtk/gtk_compat.h
|
||||
@@ -37,6 +37,9 @@ using SkColor = uint32_t;
|
||||
|
||||
namespace gtk {
|
||||
|
||||
+// Get handle to the currently loaded gtk library in the process.
|
||||
+void* GetLibGtk();
|
||||
+
|
||||
// Loads libgtk and related libraries and returns true on success.
|
||||
bool LoadGtk();
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Fri, 10 Apr 2020 17:47:18 -0700
|
||||
Subject: ui_gtk_public_header.patch
|
||||
|
||||
Allow electron to depend on gtk_util.h and gtk_ui.h from //ui/gtk/
|
||||
|
||||
diff --git a/ui/gtk/BUILD.gn b/ui/gtk/BUILD.gn
|
||||
index 4093df78da0bbb1d8df743942f364cf728ad3414..2f7c404307bfebb0e2890148cf9b0d6d9c68094f 100644
|
||||
--- a/ui/gtk/BUILD.gn
|
||||
+++ b/ui/gtk/BUILD.gn
|
||||
@@ -69,7 +69,11 @@ generate_stubs("gtk_stubs") {
|
||||
}
|
||||
|
||||
component("gtk") {
|
||||
- public = [ "gtk_ui_factory.h" ]
|
||||
+ public = [
|
||||
+ "gtk_ui.h",
|
||||
+ "gtk_ui_factory.h",
|
||||
+ "gtk_util.h",
|
||||
+ ]
|
||||
|
||||
sources = [
|
||||
"gtk_color_mixers.cc",
|
||||
@@ -79,13 +83,11 @@ component("gtk") {
|
||||
"gtk_key_bindings_handler.cc",
|
||||
"gtk_key_bindings_handler.h",
|
||||
"gtk_ui.cc",
|
||||
- "gtk_ui.h",
|
||||
"gtk_ui_factory.cc",
|
||||
"gtk_ui_platform.h",
|
||||
"gtk_ui_platform_stub.cc",
|
||||
"gtk_ui_platform_stub.h",
|
||||
"gtk_util.cc",
|
||||
- "gtk_util.h",
|
||||
"input_method_context_impl_gtk.cc",
|
||||
"input_method_context_impl_gtk.h",
|
||||
"native_theme_gtk.cc",
|
Loading…
Add table
Add a link
Reference in a new issue