Delen via


C28624

waarschuwing C28624: Geen aanroep naar Release() om te komen overeen met incrementele refcount van LResultFromObject

LresultFromObject verhoogt het aantal refcount op nieuwe IAccessible-objecten.

voorbeeld

In het volgende codevoorbeeld wordt deze waarschuwing gegenereerd.

{
 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 );
}

In het volgende voorbeeld wordt de fout voorkomen.

{
 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();
}