简体   繁体   English

有没有办法查询_com_ptr_t对象的当前引用计数?

[英]Is there a way to query the current reference count of a _com_ptr_t object?

I'm having some issues (crashing) with a COM object that is wrapped in a _com_ptr_t template object. 我遇到了一个包装在_com_ptr_t模板对象中的COM对象的问题(崩溃)。 I need to interrogate the object to see what the reference count is, because I'm pretty sure that the object is getting destroyed prematurely. 我需要询问对象以查看引用计数是什么,因为我非常确定该对象会被过早破坏。

It would be even better if I could somehow hook into the AddRef() and Release() functions, but I can't seem to find where these are beyond the ones located in the _com_ptr_t class. 如果我能以某种方式挂接到AddRef()Release()函数,那会更好,但是我似乎找不到除_com_ptr_t类中的函数之外的其他函数。 Ideas? 有想法吗?

_com_ptr_t wraps an IUnknown instance, but hides the return of AddRef and Release which would be the current reference count. _com_ptr_t包装了一个IUnknown实例,但隐藏了AddRefRelease的返回值,它们将是当前引用计数。 GetInterfacePtr should "lift the fog". GetInterfacePtr应该“解除迷雾”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM