xserver extensions/hooks: freeing client resources

Aaron Plattner aplattner at nvidia.com
Mon Feb 5 23:30:00 UTC 2024


On 2/1/24 7:03 AM, Enrico Weigelt, metux IT consult wrote:
> Hello folks,
>
>
> I'm currently writing an extension that's storing per-client data.
>
> Where's is the right place to free up all resources ? I guess the client
> state xace hook - but what's the difference between retained and gone ?

I don't think you need xace for this: CloseDownClient calls 
CallCallbacks((&ClientStateCallback), (void *) &clientinfo) so you can 
register a callback on that.

"Retained" means that the client's resources should remain allocated in 
the server even after the client is gone. It's not a super useful 
mechanic these days but you'll have to decide whether a "retained" 
client disappearing should free your per-client data or not.

The other option is to use AddResource to allocate resources associated 
with a particular client's XIDs. Those are freed by 
FreeClientNeverRetainResources or FreeClientResources, depending on 
whether the client is supposed to be retained and whether the resource 
type in question is marked with the RC_NEVERRETAIN flag.

-- Aaron

>
>
> thx
> --mtx
>
> -- 
> ---
> Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert
> werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren
> GPG/PGP-Schlüssel zu.
> ---
> Enrico Weigelt, metux IT consult
> Free software and Linux embedded engineering
> info at metux.net -- +49-151-27565287


More information about the xorg-devel mailing list