Reputation: 51
I have a timer which calls a method (perform_step
) every second. perform_step
does some computation and invalidates my window. This works well initially but after a small number of iterations the on_expose_event of the window isn't triggered. From debugging I discovered the window invalidation method had been called, but the event handler isn't entered.
Any ideas what might cause this? Here are some things I've discovered that might be helpful:
perform_step
is shorter, things break down after less iterations.Here a 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();
//on the last iteration this is called but on_expose_event is never reached
get_window()->invalidate(true);
}
bool SimDisplay::on_expose_event(GdkEventExpose* event) {
...
}
Upvotes: 4
Views: 213
Reputation: 400029
Your on_button_press_event()
is missing a return
statement; make sure all your handlers are returning the proper thing.
Upvotes: 1