static ULONG WINAPI CFStub_Release(LPRPCSTUBBUFFER iface) { CFStub *This = (CFStub *)iface; ULONG ref; ref = InterlockedDecrement(&This->ref); if (!ref) { IRpcStubBuffer_Disconnect(iface); HeapFree(GetProcessHeap(),0,This); } return ref; }
static void test_Disconnect(IPSFactoryBuffer *ppsf) { IUnknownVtbl *orig_vtbl = &connect_test_orig_vtbl; IUnknown *obj = (IUnknown*)&orig_vtbl; IRpcStubBuffer *pstub = create_stub(ppsf, &IID_if1, obj, S_OK); CStdStubBuffer *cstd_stub = (CStdStubBuffer*)pstub; connect_test_orig_release_called = 0; IRpcStubBuffer_Disconnect(pstub); ok(connect_test_orig_release_called == 1, "release called %d\n", connect_test_orig_release_called); ok(cstd_stub->pvServerObject == NULL, "pvServerObject %p\n", cstd_stub->pvServerObject); IRpcStubBuffer_Release(pstub); }