DirectWrite strikes again
• 1 min read
I was debugging an odd-looking Columns odd-looking crash from a Windows 8.1
device. The crash was odd because it looked like it should be impossible with
the code in question – it was caused by a pure virtual function call when trying
to call a IDWriteFont3
method.
The reason it was happening became obvious when examining the DirectWrite
headers. Compare the start of the declaration of the
IDWriteFont2
interface:
interface DWRITE_DECLARE_INTERFACE("29748ed6-8c9c-4a6a-be0b-d912e8538944") IDWriteFont2 : public IDWriteFont1
…with the start of the declaration of the
IDWriteFont3
interface:
interface DWRITE_DECLARE_INTERFACE("29748ED6-8C9C-4A6A-BE0B-D912E8538944") IDWriteFont3 : public IDWriteFont2
Notice anything odd? I did – they both have the same UUID as their IID. That
means, you can successfully query a COM object for the IDWriteFont3
interface,
when it in fact only supports IDWriteFont2
. And that’s exactly what happens
on Windows 8.1.
Sheesh.
Post a comment