From 6b458ad7fadedf6eb10c6fd3964d5caa409353da Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 14 Feb 2013 07:51:25 -0800 Subject: [PATCH] Ensure that planner warnings get shown before calculations are run Linus pointed out that the warning wasn't shown until the main loop got control back, so even a gtk_widget_show_all() doesn't really help to make sure that things are shown right then. This commit adds a little loop to handle all pending gtk_events before exiting the show_error() function. Now the warning should be shown BEFORE a potentially slow calculation gets started. Suggested-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- planner.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/planner.c b/planner.c index 0e9725b55..245cb1bbb 100644 --- a/planner.c +++ b/planner.c @@ -83,6 +83,9 @@ static void show_error(const char *fmt, ...) if (!bar_is_visible) gtk_box_pack_start(GTK_BOX(box), planner_error_bar, FALSE, FALSE, 0); gtk_widget_show_all(box); + /* make sure this actually gets shown BEFORE the calculations run */ + while (gtk_events_pending()) + gtk_main_iteration_do(FALSE); } void get_gas_from_events(struct divecomputer *dc, int time, int *o2, int *he)