1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-16 06:25:24 +00:00

Fix delay at startup when running against glib 2.49.3+

In glib v2.49.3, an optimization was made to eliminate certain
unnecessary wakeups.  (The specific change was made in
e4ee3079c5afc3c1c3d2415f20c3e8605728f074). Before this change, the
first call to g_main_iteration would always complete immediately.
In Irssi, this effectively reversed the order of the main loop, causing
the reload_config check and the dirty_check to run *before* the first
blocking call to g_main_iteration.

With the new logic, the first g_main_iteration call now blocks,
preventing the screen from being refreshed until the user starts typing
or a timer goes off.  (It also delays processing of SIGHUP, but I
expect that is not a common situation.)

This commit reorders the main loop to wait at the end of the loop,
rather than the beginning, addressing the problem.

(This closes Debian bug #856201.)
This commit is contained in:
Stephen Oberholtzer 2017-03-21 09:08:42 -04:00
parent 966efced3c
commit 70f9db3cbd

View File

@ -317,10 +317,6 @@ int main(int argc, char **argv)
/* Does the same as g_main_run(main_loop), except we
can call our dirty-checker after each iteration */
while (!quitting) {
term_refresh_freeze();
g_main_iteration(TRUE);
term_refresh_thaw();
if (reload_config) {
/* SIGHUP received, do /RELOAD */
reload_config = FALSE;
@ -328,6 +324,10 @@ int main(int argc, char **argv)
}
dirty_check();
term_refresh_freeze();
g_main_iteration(TRUE);
term_refresh_thaw();
}
g_main_destroy(main_loop);