mirror of
https://gitlab.freedesktop.org/xorg/lib/libx11.git
synced 2026-05-08 14:58:08 +02:00
Allow re-entrant Xlib calls from _XIOError.
Some libraries try to clean up X resources from atexit handlers, _fini, or C++ destructors. To make these work, the Display lock should be downgraded to a user lock (as in XLockDisplay) before calling exit(3). This blocks Xlib calls from threads other than the one calling exit(3) while still allowing the exit handlers to call Xlib. This assumes that the thread calling exit will call any atexit handlers. If this does not hold, then an alternate solution would involve registering an atexit handler to take over the lock, which would only assume that the same thread calls all the atexit handlers. Commit by Josh Triplett and Jamey Sharp.
This commit is contained in:
parent
91b02b8064
commit
95523387d6
1 changed files with 10 additions and 0 deletions
|
|
@ -2926,6 +2926,16 @@ _XIOError (
|
|||
errno = WSAGetLastError();
|
||||
#endif
|
||||
|
||||
/* This assumes that the thread calling exit will call any atexit handlers.
|
||||
* If this does not hold, then an alternate solution would involve
|
||||
* registering an atexit handler to take over the lock, which would only
|
||||
* assume that the same thread calls all the atexit handlers. */
|
||||
#ifdef XTHREADS
|
||||
if (dpy->lock)
|
||||
(*dpy->lock->user_lock_display)(dpy);
|
||||
#endif
|
||||
UnlockDisplay(dpy);
|
||||
|
||||
if (_XIOErrorFunction != NULL)
|
||||
(*_XIOErrorFunction)(dpy);
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue