C28624
警告 C28624:没有调用 Release () 以匹配 LResultFromObject 中的递增 refcount
LresultFromObject 增加了新 IAccessible 对象上的 refcount。
示例
下面的代码示例生成此警告。
{
IAccessible *pacc = CreateNewIAccessible();
LRESULT lTemp = LresultFromObject(riid, NULL, pacc );
}
{
IAccessible *pacc = NULL;
// Get new interface (from same object)
QueryInterface( & pacc );
// Lresult will internally bump up the refcount
// to hold onto the object.
LRESULT lTemp = LresultFromObject( riid, NULL, pacc );
}
以下示例避免了此错误。
{
IAccessible *pacc = CreateNewIAccessible();
// Lresult internally increases the refcount to
// hold onto the object.
LRESULT lTemp = LresultFromObject(riid, NULL, pacc );
// We no longer need our pacc interface, so we release it.
pacc->Release();
}