Hasty Briefsbeta

Bilingual

Making an agile version of a Windows Runtime delegate in C++/WinRT, part 4 - The Old New Thing

12 hours ago
  • Improved delegate by comparing context tokens instead of COM objects for efficiency.
  • CoGetContextToken provides a unique integer identifier for live context objects.
  • Context tokens can be reused only after the context is destroyed, similar to process/thread IDs.
  • Storing both IContextCallback and context token enables faster identity checks.
  • Potential flaw: IContextCallback may return different pointers for the same context due to tear-off interfaces, causing incorrect comparisons.
  • Tear-off interfaces can lead to subtle bugs, especially with COM object identity checks.