summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2016-03-29 19:38:34 +0200
committerPatrick Griffis <tingping@tingping.se>2016-03-30 08:11:07 -0400
commit0635e91dd6f43ae4944e845cc44a429dbd2352fb (patch)
tree155543f7704bf4486b377596bc463d5fdc586378 /src
parent5f2d6a3c115b8029b43c57e7c808a7191956e287 (diff)
Don't flush the chanopt_list when saving it
Closes #1665
Fixes #1134
Diffstat (limited to 'src')
-rw-r--r--src/common/chanopt.c18
-rw-r--r--src/common/chanopt.h2
-rw-r--r--src/common/hexchat.c2
-rw-r--r--src/common/outbound.c2
-rw-r--r--src/fe-gtk/maingui.c2
5 files changed, 16 insertions, 10 deletions
diff --git a/src/common/chanopt.c b/src/common/chanopt.c
index 56d1b1eb..9b7c4f24 100644
--- a/src/common/chanopt.c
+++ b/src/common/chanopt.c
@@ -396,7 +396,7 @@ chanopt_save_one_channel (chanopt_in_memory *co, int fh)
 }
 
 void
-chanopt_save_all (void)
+chanopt_save_all (gboolean flush)
 {
 	int i;
 	int num_saved;
@@ -438,15 +438,21 @@ chanopt_save_all (void)
 		}
 
 cont:
-		g_free (co->network);
-		g_free (co->channel);
-		g_free (co);
+		if (flush)
+		{
+			g_free (co->network);
+			g_free (co->channel);
+			g_free (co);
+		}
 	}
 
 	close (fh);
 
-	g_slist_free (chanopt_list);
-	chanopt_list = NULL;
+	if (flush)
+	{
+		g_slist_free (chanopt_list);
+		chanopt_list = NULL;
+	}
 
 	chanopt_open = FALSE;
 	chanopt_changed = FALSE;
diff --git a/src/common/chanopt.h b/src/common/chanopt.h
index 18b9a432..a5494605 100644
--- a/src/common/chanopt.h
+++ b/src/common/chanopt.h
@@ -22,7 +22,7 @@
 
 int chanopt_command (session *sess, char *tbuf, char *word[], char *word_eol[]);
 gboolean chanopt_is_set (unsigned int global, guint8 per_chan_setting);
-void chanopt_save_all (void);
+void chanopt_save_all (gboolean flush);
 void chanopt_save (session *sess);
 void chanopt_load (session *sess);
 
diff --git a/src/common/hexchat.c b/src/common/hexchat.c
index caa20eb7..499df8b0 100644
--- a/src/common/hexchat.c
+++ b/src/common/hexchat.c
@@ -960,7 +960,7 @@ hexchat_exit (void)
 	notify_save ();
 	ignore_save ();
 	free_sessions ();
-	chanopt_save_all ();
+	chanopt_save_all (TRUE);
 	servlist_cleanup ();
 	fe_exit ();
 }
diff --git a/src/common/outbound.c b/src/common/outbound.c
index 5ca8b783..fed83714 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -581,7 +581,7 @@ cmd_chanopt (struct session *sess, char *tbuf, char *word[], char *word_eol[])
 	
 	/* chanopt.c */
 	ret = chanopt_command (sess, tbuf, word, word_eol);
-	chanopt_save_all ();
+	chanopt_save_all (FALSE);
 	
 	return ret;
 }
diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c
index d718dba0..6ab322bc 100644
--- a/src/fe-gtk/maingui.c
+++ b/src/fe-gtk/maingui.c
@@ -1514,7 +1514,7 @@ mg_set_guint8 (GtkCheckMenuItem *item, guint8 *setting)
 		log_open_or_close (sess);
 
 	chanopt_save (sess);
-	chanopt_save_all ();
+	chanopt_save_all (FALSE);
 }
 
 static void