draw: Ensure that prepare is always run after LLVM garbagge collection.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 27 Jan 2012 14:40:06 +0000 (14:40 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 27 Jan 2012 18:24:14 +0000 (18:24 +0000)
Should avoid dangling pointer derreference with

  glean --run results --overwrite --quick --tests texSwizzle

NOTE: This is a candidate for the 8.0 branch.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/draw/draw_llvm.c

index e71c802696f673ceeaaf8fc0bdf027d7b0ea19d4..b81c72573bdb5ee727745ecc9164e14af98c3a4b 100644 (file)
@@ -65,8 +65,13 @@ static void
 draw_llvm_garbage_collect_callback(void *cb_data)
 {
    struct draw_llvm *llvm = (struct draw_llvm *) cb_data;
+   struct draw_context *draw = llvm->draw;
    struct draw_llvm_variant_list_item *li;
 
+   /* Ensure prepare will be run and shaders recompiled */
+   assert(!draw->suspend_flushing);
+   draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
+
    /* free all shader variants */
    li = first_elem(&llvm->vs_variants_list);
    while (!at_end(&llvm->vs_variants_list, li)) {