From: Anuj Phogat Date: Wed, 11 Jan 2012 23:26:10 +0000 (-0800) Subject: intel: Fix segfault in glXSwapBuffers with no bound context X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dd7220652e65a8a23e7739eeee687f3d6a865b80;p=mesa.git intel: Fix segfault in glXSwapBuffers with no bound context Calling glXSwapBuffers with no bound context causes segmentation fault in function intelDRI2Flush. All the gl calls should be ignored after setting the current context to null. So the contents of framebuffer stay unchanged. But the driver should not seg fault. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44614 Reported-by: Yi Sun Signed-off-by: Anuj Phogat Reviewed-by: Kenneth Graunke Tested-by: Yi Sun --- diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index b0e800b7ecc..a08f3d12b67 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -115,13 +115,15 @@ intelDRI2Flush(__DRIdrawable *drawable) GET_CURRENT_CONTEXT(ctx); struct intel_context *intel = intel_context(ctx); - if (intel->gen < 4) - INTEL_FIREVERTICES(intel); + if (intel != NULL) { + if (intel->gen < 4) + INTEL_FIREVERTICES(intel); - intel->need_throttle = true; + intel->need_throttle = true; - if (intel->batch.used) - intel_batchbuffer_flush(intel); + if (intel->batch.used) + intel_batchbuffer_flush(intel); + } } static const struct __DRI2flushExtensionRec intelFlushExtension = {