views:

38

answers:

1

When ever IVideoWindow::put_Visible() is invoked, it peek a message from the message queue and dispatch it. That totally messes up the call sequence.

I have fixed several crashes caused by this, in a case by case bias. That is, to set a flag before invoking put_Visible() and then clean the flag. And in an event-handler, check the flag first, if it is set, put the event back to message queue and exit the event-handler (i.e. postpone the handling until put_Visible() returns. The problem is my code base is too large and that method does not sustain.

Is there a way simply change the behavior of put_Visible() to make it don't mess the message queue and dispatching?

A: 

Eventually I get an idea but not verified it. That's to invoke put_Visible() in a second new thread. Because Win32 have separated threads have separated message queues, the put_Visible() will unlikely to mess the main message queue.

Middleware