[GTK] Prevent loading both GTK3 and GTK4 libraries
Attempting to do so results in the following fatal error: Gtk-ERROR **: 19:44:30.851: GTK 2/3 symbols detected. Using GTK 2/3 and GTK 4 in the same process is not supported This may happen, for example, if a QT theme loads GTK3 because it derives some colors from GTK. R=thestig Change-Id: I0ca62bd6f65a25d208a3ff4dd702b6b3492a0bd2 Fixed: 406228267 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6505767 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Thomas Anderson <thomasanderson@chromium.org> Cr-Commit-Position: refs/heads/main@{#1455070}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
5dc11c6d80
commit
c7c02544a3
@ -123,6 +123,16 @@ bool LoadGtk4() {
|
||||
}
|
||||
|
||||
bool LoadGtkImpl() {
|
||||
// If GTK3 or GTK4 is somehow already loaded, then the preloaded library must
|
||||
// be used, because GTK3 and GTK4 have conflicting symbols and cannot be
|
||||
// loaded simultaneously.
|
||||
if (dlopen("libgtk-3.so.0", RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD)) {
|
||||
return LoadGtk3();
|
||||
}
|
||||
if (dlopen("libgtk-4.so.1", RTLD_LAZY | RTLD_GLOBAL | RTLD_NOLOAD)) {
|
||||
return LoadGtk4();
|
||||
}
|
||||
|
||||
auto* cmd = base::CommandLine::ForCurrentProcess();
|
||||
unsigned int gtk_version;
|
||||
if (!base::StringToUint(cmd->GetSwitchValueASCII(kGtkVersionFlag),
|
||||
|
Reference in New Issue
Block a user