Bagikan melalui


C28624

peringatan C28624: Tidak ada panggilan ke Release() untuk mencocokkan refcount bertahap dari LResultFromObject

LresultFromObject meningkatkan pengenalan pada objek IAccessible baru.

Contoh

Contoh kode berikut menghasilkan peringatan ini.

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

Contoh berikut menghindari kesalahan.

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