There's no reason to introduce global variable for that, just to remove it two patches after.
It's not split the functionality into two patches. I could merge them if you want, but I thought it would be easier to understand if I separated those two logical changes. First getting it to work with a global variable, then change it into something thread-safe.
For minimal working replacement of MessageBox callback support is not needed, right?
No it's not needed. But, we certainly want the tests, don't we? Without callback, there'll be no tests.
Regards, Fabian Maurer