From 6eb9c49c980fb3ecd5384fc4e253e7047de54b26 Mon Sep 17 00:00:00 2001 From: g Date: Mon, 1 Sep 2003 13:22:47 +0000 Subject: [PATCH] process_events() update, the number of processed events is bounded. git-svn-id: file:///srv/svn/gliv/trunk@68 dbf4865f-1ec6-0310-8412-f61adeb1ccb1 committer: g --- src/callbacks.c | 10 +++++++--- src/loading.c | 2 -- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/callbacks.c b/src/callbacks.c index 2eae2a6..9e64ef3 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -444,11 +444,15 @@ void install_callbacks(gpointer object) } /* - * We repeatedly call process_events() when waiting for a thread or a - * process, when rebuilding the images menus or to wait for a refresh. + * We call process_events() when rebuilding the images menus and to wait for a + * refresh. + * We limit the number of events processed to avoid starving the caller, + * but we let a margin for events created during a gtk_main_iteration_do(). */ void process_events(void) { - while (gtk_events_pending() != 0) + gint allowed_events = gtk_events_pending() * 2; + + while (allowed_events-- != 0 && gtk_events_pending() != 0) gtk_main_iteration_do(FALSE); } diff --git a/src/loading.c b/src/loading.c index 5647992..ab55bb2 100644 --- a/src/loading.c +++ b/src/loading.c @@ -212,8 +212,6 @@ static void clean_alpha(GdkPixbuf * pixbuf) { guchar *pixel, *end; - process_events(); - pixel = gdk_pixbuf_get_pixels(pixbuf); end = pixel + gdk_pixbuf_get_rowstride(pixbuf) * gdk_pixbuf_get_height(pixbuf); -- 2.11.4.GIT