I have a timer that calls a method ( perform_step ) every second. perform_step does some calculations and invalidates my window. This works well initially, but after a few iterations, the on_expose_event window does not start. From debugging, I found that the window invalidation method was called, but no event handler was introduced.
Any ideas what might cause this? Here are some things that I have found to be useful:
- When the calculation in
perform_step shorter, everything happens after smaller iterations. - Things break after the same number of iterations every time.
- Moving the mouse over the window causes things to collapse. If I constantly move the mouse over the window, everything will work forever. It seems like a "reset" counter. If something broke after 10 iterations, and at the 9th iteration I move the mouse cursor over the window, things then break at the 19th iteration.
Here's the code snippet:
bool SimDisplay::on_button_press_event(GdkEventButton* event) { Glib::signal_timeout().connect( sigc::mem_fun(*this, &SimDisplay::perform_step), 1000 ); } bool SimDisplay::perform_step() { world->step();
source share