Hi,
I have a problem when trying to exit an event loop I've created. I check if there is a pending event before exiting the loop, otherwise I may miss events that I'm waiting for.
However there seems to be a mystery event stuck in the event queue which is preventing the loop exiting. I can force it out with loop->Dispatch(), but that doesn't really explain what is causing it.
My questions are, how can I check what the event stuck in the queue is? I am using FilterEvent but it doesn't seem to show the other event, or at least it looks the same when I don't force the event with Dispatch().
And do idle events count as pending events in the event queue?
Thanks,
Zobbo.
Event loop questions Topic is solved
Event loop questions
Zobbo
Wxwidgets 2.9.0, Visual C++ Express 2005, Windows Vista x64 Home Premium
Wxwidgets 2.9.0, Visual C++ Express 2005, Windows Vista x64 Home Premium
My thought you are trying to read a message twice, for example you have a message handler active and your filter routine. You may need a message skip in the other or routing situation. The possibility also is a library message handler that isn't cleaning up properly.
17+ years of c++, currently open watcom and wxWidgets, MFC experience. C::B user.
The world begins again. Are you going to be one of the 2 billion left?
The world begins again. Are you going to be one of the 2 billion left?
Thanks Azagoras. Yes, maybe something like that. My filter routine always returns -1 so it shouldn't affect the events. It seems to be timing related also, if I put certain breakpoints in it will get stuck in the loop, otherwise it works because I exit it if there is nothing pending. Still makes debugging problematic though if it gets stuck in the loop sometimes. I did used to use skip but removed it, so maybe I should look into that again. I wonder if also I should run it off a worker thread so I'm not relying on the loop to exit.Azagaros wrote:My thought you are trying to read a message twice, for example you have a message handler active and your filter routine. You may need a message skip in the other or routing situation. The possibility also is a library message handler that isn't cleaning up properly.
Cheers,
Zobbo
Zobbo
Wxwidgets 2.9.0, Visual C++ Express 2005, Windows Vista x64 Home Premium
Wxwidgets 2.9.0, Visual C++ Express 2005, Windows Vista x64 Home Premium