pipebuffer: avoid assert due to increasing a zeroed refcnt
authorLuca Barbieri <luca@luca-barbieri.com>
Tue, 23 Feb 2010 16:50:15 +0000 (08:50 -0800)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 23 Feb 2010 19:50:24 +0000 (19:50 +0000)
The cache manager stores buffers with a reference count that dropped to 0.
pipe_reference asserts in this case on debug builds,
so use pipe_reference_init instead.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c

index 53bc019a204eebbb955b91260cf38cdafb0e3f30..86f9266c95ff2490362debf12fda1f5b1672ca6d 100644 (file)
@@ -294,7 +294,7 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
       LIST_DEL(&buf->head);
       pipe_mutex_unlock(mgr->mutex);
       /* Increase refcount */
-      pipe_reference(NULL, &buf->base.base.reference);
+      pipe_reference_init(&buf->base.base.reference, 1);
       return &buf->base;
    }