From a936afc3ebb349c3aec8b5a595706f3c9749ad37 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 19 Feb 2013 13:28:24 +0000 Subject: [PATCH] d3dretrace: Replay IUnknown::AddRef/Release methods faithfully. 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 | 5 ++--- specs/winapi.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/retrace/retrace.py b/retrace/retrace.py index d09d72a..70926c0 100644 --- a/retrace/retrace.py +++ b/retrace/retrace.py @@ -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: diff --git a/specs/winapi.py b/specs/winapi.py index 031c834..4436c6d 100644 --- a/specs/winapi.py +++ b/specs/winapi.py @@ -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", ()), ) -- 2.43.0