Sorry for such a weird question, but I've discovered that my application using CEF (and GTK) crashes on startup under Ubuntu 22.04 even though it works perfectly fine under Debian 12. Debugging the crash shows that it happens because, after initializing successfully, the main window gets repainted and while handling the "repaint" event GTK uses Pango which uses Cairo which ends up calling XGetDefault("Xft", "antialias") which crashes due to trying to lock a null mutex.
And I can reproduce the problem simply by calling XGetDefault() with these parameters myself during the application startup, but the "funny" thing is that this call works perfectly fine just before CefInitialize() but crashes if it's called immediately after it.
My only idea is that this is somehow related to the fact that I need to do the equivalent of LD_PRELOAD=libcef.so (i.e. I need to either just do exactly this or put it as the very first library on the linker command line with -Wl,--no-as-needed before it, as it's actually not referenced by the executable itself, but only by another shared library used by it), and so some "wrong" function gets somehow called, but I can't avoid doing this as otherwise CEF doesn't work at all and, anyhow, I don't really see how could it result in this problem, so maybe this idea is completely wrong.
Searching the web for "XGetDefault" and "XrmQGetResource" (which is the function called from it that actually crashes) I can see that others ran into this problem before, in several different applications using CEF or in Chrome itself, but there is never any explanation for it. If anybody has any idea about what could be going on here and any suggestions for how to fix, or work around, this problem, I'd be very grateful!