mapi: do not return thread-specific data for wrong thread

If the current thread asks for either the current context or the current
dispatch table for a thread that has not yet set any context current, we
currently risk returning the wrong data if there was only a single
thread that had called u_current_init() yet.

So let's first check if the only expected thread-id is the one getting
these, and return NULL and/or __glapi_noop_table instead if not.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7280>
1 file changed