glXSwapIntervalMESA crashes when making use of GLX_MESA_multithread_makecurrent
Submitted by James Legg
Assigned to mes..@..op.org
Description
Created attachment 114264 test case
If two threads have the same current glX context, as permitted by GLX_MESA_multithread_makecurrent, then calling glXSwapIntervalMESA results in invoking dri2SetSwapInterval with the pdraw argument set to NULL. dri2SetSwapInterval then dereferences pdraw, causing a segmentation fault. The attached program reproduces this.
You can also reproduce the same crash by letting a thread exit with a context bound and then making the context current on another thread and calling glXSwapIntervalMESA there (this seems a bit dirty, but if there is no requirement to unbind GL contexts before exiting threads, then this method doesn't require GLX_MESA_multithread_makecurrent). If you add -DTEST2 to the compiler flags when compiling the attached file, this crash will be reproduced instead.
This affects at least Mesa 10.4.3, 10.5, and git master at revision 48b0a3c1.
Attachment 114264, "test case":
multithreaded_make_current_and_glXSwapIntervalMesa.cc
Version: git