dix: dixutils: make workQueue pointer dix-private

The workQueue pointer is currently declared extern, so that WaitForSomething()
can check wether we've got something in the queue and call ProcessWorkQueue()
then.

But that's trivial to simplify: just let ProcessWorkQueue() return early if
workQueue == NULL. Gives us a better isolation of internal stuff as well as
ProcessWorkQueue() protecting itself from possible segfault.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1310>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-02-19 12:52:25 +01:00 committed by Marge Bot
parent 834acc88fb
commit af9f70013a
4 changed files with 8 additions and 11 deletions

View File

@ -525,6 +525,10 @@ ProcessWorkQueue(void)
{ {
WorkQueuePtr q, *p; WorkQueuePtr q, *p;
// don't have a work queue yet
if (!workQueue)
return;
p = &workQueue; p = &workQueue;
/* /*
* Scan the work queue once, calling each function. Those * Scan the work queue once, calling each function. Those

View File

@ -657,13 +657,10 @@ make the server suspend until one or more of the following occurs:
<para> <para>
Before WaitForSomething() computes the masks to pass to select, poll or Before WaitForSomething() computes the masks to pass to select, poll or
similar operating system interface, it needs to similar operating system interface, it needs to
see if there is anything to do on the work queue; if so, it must call a DIX see if there is anything to do on the work queue; it must call a DIX
routine called ProcessWorkQueue. routine called ProcessWorkQueue().
<blockquote> <blockquote>
<programlisting> <programlisting>
extern WorkQueuePtr workQueue;
if (workQueue)
ProcessWorkQueue (); ProcessWorkQueue ();
</programlisting> </programlisting>
</blockquote> </blockquote>

View File

@ -188,9 +188,7 @@ WaitForSomething(Bool are_ready)
crashed connections and the screen saver timeout */ crashed connections and the screen saver timeout */
while (1) { while (1) {
/* deal with any blocked jobs */ /* deal with any blocked jobs */
if (workQueue) {
ProcessWorkQueue(); ProcessWorkQueue();
}
timeout = check_timers(); timeout = check_timers();
are_ready = clients_are_ready(); are_ready = clients_are_ready();

View File

@ -123,8 +123,6 @@ listen_to_client(ClientPtr client);
extern Bool NewOutputPending; extern Bool NewOutputPending;
extern WorkQueuePtr workQueue;
/* in access.c */ /* in access.c */
extern Bool ComputeLocalClient(ClientPtr client); extern Bool ComputeLocalClient(ClientPtr client);