xserver icon indicating copy to clipboard operation
xserver copied to clipboard

fix crashing when Xnamespace is enabled and a minor improvement

Open mahiro21h opened this issue 5 months ago • 10 comments

currently, the xserver can crash when running with xnamespace extension enabled when closing clients. this is due to the client's namespace being cleared when the client closes but before other code is done using its value. this pr solves this by adding a new client state before ClientStateGone and having all other code use this new state. this way xnamespace can clear the client's namespace after the other code is done using its value.

this pr also changes code in xnamespace to print everything into the xserver's log by having all XNS log macros call LogMessage() instead and replacing all instances of printf with XNS_LOG().

closes: #486

mahiro21h avatar Sep 17 '25 09:09 mahiro21h

hmm, maybe it's better adding action field to NewClientInfoRec telling what really happens, so we look at this instead of the current state. And then add another call right at the place where the client is destroyed

metux avatar Sep 17 '25 10:09 metux

sounds good to me for now. i'll try and see what happens.

mahiro21h avatar Sep 17 '25 10:09 mahiro21h

@metux is it all good now?

mahiro21h avatar Sep 17 '25 12:09 mahiro21h

after sleeping over this, I'm thinking we should do it a much simpler way: just add new new callback that's fired when a client is actually destroyed, and leave the existing hook alone.

metux avatar Sep 18 '25 08:09 metux

Here's a very simple and straightforward approach: just adding a new callback.

https://github.com/X11Libre/xserver/pull/1090

Once that's merged, we easily use it for fixing this bug - no need to ever tinker with client-state's

metux avatar Sep 18 '25 16:09 metux

Here's a very simple and straightforward approach: just adding a new callback.

#1090

Once that's merged, we easily use it for fixing this bug - no need to ever tinker with client-state's

Hacked up a quick fix based on this in branch wip/client-destroy-hook - haven't had the time to really test it yet.

metux avatar Sep 18 '25 17:09 metux

Here's a very simple and straightforward approach: just adding a new callback.

#1090

Once that's merged, we easily use it for fixing this bug - no need to ever tinker with client-state's

It's merged now, so we can use it.

metux avatar Sep 22 '25 11:09 metux

@mahiro21h needs rebase and resolving conflicts. perhaps the issue already is resolved by recent commits (new callback)

metux avatar Sep 26 '25 15:09 metux

Merge Conflict found

github-actions[bot] avatar Sep 29 '25 09:09 github-actions[bot]

@mahiro21h needs rebase

metux avatar Nov 26 '25 16:11 metux