This is really unfortunate as it has caused quite a few errors in one of our applications.
We have registered a "hidden" exception handler using RegisterHiddenExceptionHandler() in order to log handled exceptions.
The list of these exceptions is included in our bug reports.
The scenario that causes the problem goes something like this:
- The user clicks a button on a form.
- As a response to this we need to execute some code XXX and only then refresh the user interface.
- We post a message to ourselves using PostMessage().
The message handler for this message will update the user interface.
- During execution of the XXX code an exception is raised and handled.
- MadExcept intercepts the destruction of the exception object and calls HandleException().
- HandleException() pumps the message queue.
- Our message is fetched from the queue and dispatched.
- The message handler updates the user interface prematurely -> Error.
Since it is a quite common technique to use messages to defer execution I find it very problematic that HandleException() pumps the message queue.
Why does it do that anyway?
Since I register the hidden exception handler with stDontSync no messages should be involved and even if MadExcept uses messages internally it should limit the message pump to its own messages.