DWrite/GeometryRecorder: Complete implementation of QueryInterface

...by checking for IUnknown.

This makes GeometryRecorder::QueryInterface compliant with the
rules of COM.

QueryInterface for IUnknown has a special meaning in COM: it's
used to check whether two interface pointers refer to the same
object.
This commit is contained in:
Luca Bacci 2025-01-16 12:02:27 +01:00
parent 59197e7791
commit 46153a0408

View file

@ -845,15 +845,18 @@ public:
: mCairoPath(aCairoPath)
, mMatrix(matrix) {}
// IUnknown interface
IFACEMETHOD (QueryInterface)(IID const& iid, OUT void** ppObject) noexcept override
{
if (iid != __uuidof(IDWriteGeometrySink))
return E_NOINTERFACE;
if (iid == __uuidof (IUnknown) ||
iid == __uuidof (IDWriteGeometrySink))
{
AddRef();
*ppObject = this;
return S_OK;
}
*ppObject = static_cast<IDWriteGeometrySink*>(this);
return S_OK;
*ppObject = nullptr;
return E_NOINTERFACE;
}
IFACEMETHOD_(ULONG, AddRef)() noexcept override