From bba5603903722221bd2f319835e924baf74b2b30 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 20 Jan 2002 03:30:28 +0000 Subject: Autosaving settings and autoflushing write buffer might have stopped from working sometimes because of missing "return 1". git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2325 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/settings.c | 6 ++++-- src/core/write-buffer.c | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'src/core') diff --git a/src/core/settings.c b/src/core/settings.c index 7ded9ae2..b13163e0 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -605,13 +605,13 @@ int settings_save(const char *fname, int autosave) return !error; } -static void sig_autosave(void) +static int sig_autosave(void) { char *fname, *str; if (!settings_get_bool("settings_autosave") || config_last_modifycounter == mainconfig->modifycounter) - return; + return 1; if (!irssi_config_is_changed(NULL)) settings_save(NULL, TRUE); @@ -628,6 +628,8 @@ static void sig_autosave(void) settings_save(fname, TRUE); g_free(fname); } + + return 1; } void settings_init(void) diff --git a/src/core/write-buffer.c b/src/core/write-buffer.c index 762fc24e..1c3eef82 100644 --- a/src/core/write-buffer.c +++ b/src/core/write-buffer.c @@ -126,13 +126,16 @@ void write_buffer_flush(void) block_count = 0; } +static int flush_timeout(void) +{ + write_buffer_flush(); + return 1; +} + static void read_settings(void) { int msecs; - if (timeout_tag != -1) - g_source_remove(timeout_tag); - write_buffer_flush(); write_buffer_max_blocks = settings_get_int("write_buffer_kb") * @@ -140,9 +143,14 @@ static void read_settings(void) if (settings_get_int("write_buffer_mins") > 0) { msecs = settings_get_int("write_buffer_mins")*60*1000; - timeout_tag = g_timeout_add(msecs, - (GSourceFunc) write_buffer_flush, - NULL); + if (timeout_tag == -1) { + timeout_tag = g_timeout_add(msecs, + (GSourceFunc) flush_timeout, + NULL); + } + } else if (timeout_tag != -1) { + g_source_remove(timeout_tag); + timeout_tag = -1; } } -- cgit v1.2.3