New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: potential crash caused by dlopen different gtk libraries #33650
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 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(); | ||
|
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,6 @@ | ||
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); | ||
deepak1556 marked this conversation as resolved.
Show resolved
Hide resolved
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be upstreamed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can give it an attempt.