Article

Making an agile version of a Windows Runtime delegate in C++/WinRT, part 10

The Old New Thing ·The Old New Thing ·Published 2026-07-31 ·5 min read

This article discusses the challenges and considerations when implementing agile delegates in C++/WinRT, particularly focusing on the behavior of ContextCallback in COM and its implications for error handling and reentrancy.

From the article

In part 5 of this unnecessarily long series on agile delegates , commenter LB asked , “Is the Context­Callback in the deleter guaranteed to always succeed? According to the docs it can fail. I wonder if there’s a way to move the fallible part to an earlier point so the deleter can be infallible.”

Let’s look at the first part: What if IContext­Callback:: Context­Callback fails?

If it fails, it means that COM couldn’t switch to the destination context.


Share this resource


Discovered 2026-08-02 Source The Old New Thing Archive 2026-08 →