Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: potential crash caused by dlopen different gtk libraries (#33650)
- Loading branch information
Showing
15 changed files
with
131 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 bfc0e20e7de4dd2ee0c76dbf6916657859a4fd60..8895e526a601adc90f13fa244d67958d74446e7a 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 1dc8fdba635464da3837ee55120f09c49d3ebc05..a55c911b5507fa4b6863470d1d008c49a5059f10 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(); | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <gtk/gtk.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
GtkFileChooserNative* gtk_file_chooser_native_new(const gchar* title, GtkWindow* parent, GtkFileChooserAction action, const gchar* accept_label, const gchar* cancel_label); | ||
void gtk_native_dialog_set_modal(GtkNativeDialog* self, gboolean modal); | ||
void gtk_native_dialog_show(GtkNativeDialog* self); | ||
void gtk_native_dialog_hide(GtkNativeDialog* self); | ||
gint gtk_native_dialog_run(GtkNativeDialog* self); | ||
void gtk_native_dialog_destroy(GtkNativeDialog* self); | ||
GType gtk_native_dialog_get_type(void); |
Oops, something went wrong.