[Mesa-dev] [PATCH 55/75] st/nine: Fix assert in NineUnknown_QueryInterface

Axel Davy axel.davy at ens.fr
Wed Oct 5 20:09:28 UTC 2016


From: Patrick Rudolph <siro at das-labor.org>

Tests showed that is allowed to call this method on
object that have a zero refcount.
Required for issue #230.

Signed-off-by: Patrick Rudolph <siro at das-labor.org>
Reviewed-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/iunknown.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/iunknown.c b/src/gallium/state_trackers/nine/iunknown.c
index 6d501d8..89b82ea 100644
--- a/src/gallium/state_trackers/nine/iunknown.c
+++ b/src/gallium/state_trackers/nine/iunknown.c
@@ -70,7 +70,10 @@ NineUnknown_QueryInterface( struct NineUnknown *This,
     do {
         if (GUID_equal(This->guids[i], riid)) {
             *ppvObject = This;
-            assert(This->refs);
+            /* Tests showed that this call succeeds even on objects with
+             * zero refcount. This can happen if the app released all references
+             * but the resource is still bound.
+             */
             NineUnknown_AddRef(This);
             return S_OK;
         }
-- 
2.10.0



More information about the mesa-dev mailing list