[Mesa-dev] [PATCH] mesa: Restore NULL context check in _mesa_reference_renderbuffer_().

Kenneth Graunke kenneth at whitecape.org
Sat Dec 8 00:10:43 PST 2012


Starting KDE on i965 makes the X server die in a fire with the following
assertion:

X: intel_fbo.c:94: intel_delete_renderbuffer: Assertion `irb' failed.

Obviously, this is rather unpleasant.  Bisecting revealed that:

006918c0db77e945ac56b15bc64eba502b86d56c is the first bad commit
commit 006918c0db77e945ac56b15bc64eba502b86d56c
Author: Brian Paul <brianp at vmware.com>
Date:   Sat Dec 1 10:52:42 2012 -0700

    mesa: remove warning message in _mesa_reference_renderbuffer_()

    We were warning when there was no current context and we're about
    to delete a renderbuffer, but that happens fairly often and isn't
    really a problem.

    Fixes http://bugs.freedesktop.org/show_bug.cgi?id=57754

    Note: This is a candidate for the stable branches.

    Tested-by: Ian Romanick <ian.d.romanick at intel.com>

This commit removed not only the "else emit warning" block, but the
whole NULL check as well.  Apparently it's necessary, so put it back.

Cc: Brian Paul <brianp at vmware.com>
Cc: Ian Romanick <idr at freedesktop.org>
---
 src/mesa/main/renderbuffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

While this looks like an obvious fix, I'm not clear that it's the correct one.
Seeing as we didn't pass a context before, I don't really understand why it
matters...or would cause irb == NULL, anyway.  Scrutiny welcome.

This at least un-tanks my system in the meantime.

diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index b426162..031c214 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -160,7 +160,8 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
 
       if (deleteFlag) {
          GET_CURRENT_CONTEXT(ctx);
-         oldRb->Delete(ctx, oldRb);
+         if (ctx)
+            oldRb->Delete(ctx, oldRb);
       }
 
       *ptr = NULL;
-- 
1.8.0.1



More information about the mesa-dev mailing list