]> git.cworth.org Git - apitrace/commitdiff
d3dretrace: Replay IUnknown::AddRef/Release methods faithfully.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 19 Feb 2013 13:28:24 +0000 (13:28 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 22 Feb 2013 09:59:03 +0000 (09:59 +0000)
Several D3D APIs (especially recent ones) keep track of reference counts
and will ensure errors if reference counting is not properly done.

For example, IDXGISwapChain::ResizeBuffers will fail if there are
outstanding references to its buffers.

retrace/retrace.py
specs/winapi.py

index d09d72aa2ca46aff0c10380463b51cfcb455c1c7..70926c0b39d755fe293286b88e6b86fbe3df7441 100644 (file)
@@ -478,10 +478,9 @@ class Retracer:
         # On release our reference when we reach Release() == 0 call in the
         # trace.
         if method.name == 'Release':
-            print '    if (call.ret->toUInt()) {'
-            print '        return;'
+            print '    if (call.ret->toUInt() == 0) {'
+            print '        retrace::delObj(call.arg(0));'
             print '    }'
-            print '    retrace::delObj(call.arg(0));'
 
         arg_names = ", ".join(method.argNames())
         if method.type is not stdapi.Void:
index 031c83475583176465952bba06576f18d735feae..4436c6ddb971d494329db0e1a2dd1f9d7b798407 100644 (file)
@@ -206,7 +206,7 @@ IUnknown = Interface("IUnknown")
 
 IUnknown.methods = (
        StdMethod(HRESULT, "QueryInterface", ((REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppvObj"))),
-       StdMethod(ULONG, "AddRef", (), sideeffects=False),
+       StdMethod(ULONG, "AddRef", ()),
        StdMethod(ULONG, "Release", ()),
 )