IDXGIObject::GetParent and Release
Question
The IDXGIObject
has a function to obtain a pointer to its parent GetParent
. Unfortunately, the docs don't say whether I have to call Release()
on the returned interface or not -- calling or not calling it works fine in both debug/release (that is, no crash), but I wonder whether I should release or rather not. Any idea how this is supposed to work?
Solution
Yes, GetParent() adds a reference to the returned objects, so you need to call Release () on them.
OTHER TIPS
From the MSDN docs "If the data returned is a pointer to an IUnknown, or one of its derivative classes, previously set by IDXGIObject::SetPrivateDataInterface, then ::Release() must be called on the pointer before the pointer is freed to decrement the reference count."
I would recommend calling release.