From 164108e3db5ba09d8e0605f88aa17dab83b68742 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Jun 2011 13:39:39 -0700 Subject: glx: Fix use-before-null-check in dri2InvalidateBuffers(). The compiler used our dereference here to skip the NULL check below. Fixes window resize in "jconsole -J-Dsun.java2d.opengl=True" under OpenJDK 6. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37766 Reviewed-by: Matt Turner Reviewed-by: Ian Romanick --- src/glx/dri2_glx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/glx/dri2_glx.c') diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index b9f6f7fcf03..69b47ae45e2 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -675,9 +675,14 @@ dri2InvalidateBuffers(Display *dpy, XID drawable) { __GLXDRIdrawable *pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, drawable); - struct dri2_screen *psc = (struct dri2_screen *) pdraw->psc; + struct dri2_screen *psc; struct dri2_drawable *pdp = (struct dri2_drawable *) pdraw; + if (!pdraw) + return; + + psc = (struct dri2_screen *) pdraw->psc; + #if __DRI2_FLUSH_VERSION >= 3 if (pdraw && psc->f && psc->f->base.version >= 3 && psc->f->invalidate) psc->f->invalidate(pdp->driDrawable); -- cgit v1.2.3