XInitThreads in library constructor breaks Motif!

Matthieu Herrb matthieu at herrb.eu
Mon Oct 31 07:55:08 UTC 2022


On Sun, Oct 30, 2022 at 04:08:50PM -0700, Alan Coopersmith wrote:
> On 10/29/22 19:00, Po Lu wrote:
> > Motif assumes that you can call functions that lock the display inside
> > XCheckIfEvent as it never calls XInitThreads itself.  It also never uses
> > threads.
> 
> It was never up to Motif to decide whether or not to call XInitThreads()
> - that decision was up to the applications, and if Motif assumed no
> application would ever do that, it was buggy and incompatible with such
> applications.
> 
> https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/150 is
> a proposed solution to the problem, but has not generated any interest
> in testing it or moving it forward, suggesting either everyone is
> building with the --disable-thread-safety-constructor option or is
> using correctly written software that does not make such assumptions.
> 

Oh I did miss this MR. It looks like a step in the proper direction,
since after trying to patch X*IfEvent() callbacks in several places, I
see how painful it can be. And in OpenBSD I also had to eventually add
--disable-thread-safety-constructor  to the build of libX11 1.8.1.

However one of the software that's doing a lot of Xlib calls in the
X*IfEvents() callbacks is fvwm{2,3}. The MR I send them is wrong, and I
fear they are fiddling with the input queue in the callbacks. I'll
have to test how it behaves with this change.
-- 
Matthieu Herrb


More information about the xorg-devel mailing list