summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2006-04-23 08:19:06 +0000
committerSebastien Helleu <flashcode@flashtux.org>2006-04-23 08:19:06 +0000
commit6021ee85cb3c13754a0f205469824e7f9fb0df69 (patch)
treeac35c963ebb08af603e25ec16d491a164692dfb4
parentbcee678a56db2f6fdc09b0ff5b035d5a3e3ef0e6 (diff)
downloadweechat-6021ee85cb3c13754a0f205469824e7f9fb0df69.zip
Fixed bug #16416 (crash when purging old DCC chats)
-rw-r--r--src/gui/gui-buffer.c4
-rw-r--r--src/irc/irc-dcc.c19
-rw-r--r--src/irc/irc.h1
-rw-r--r--weechat/src/gui/gui-buffer.c4
-rw-r--r--weechat/src/irc/irc-dcc.c19
-rw-r--r--weechat/src/irc/irc.h1
6 files changed, 48 insertions, 0 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 3f7107bc3..c57207384 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -435,6 +435,10 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
if (buffer->type == BUFFER_TYPE_RAW_DATA)
gui_buffer_raw_data = NULL;
+
+ /* purge DCC chat using this buffer */
+ if (CHANNEL(buffer))
+ dcc_chat_remove_channel (CHANNEL(buffer));
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
diff --git a/src/irc/irc-dcc.c b/src/irc/irc-dcc.c
index 11d28cf8b..378625b8e 100644
--- a/src/irc/irc-dcc.c
+++ b/src/irc/irc-dcc.c
@@ -510,6 +510,25 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc)
}
/*
+ * dcc_chat_remove_channel: remove a buffer for DCC chat
+ */
+
+void
+dcc_chat_remove_channel (t_irc_channel *channel)
+{
+ t_irc_dcc *ptr_dcc;
+
+ if (!channel)
+ return;
+
+ for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
+ {
+ if (ptr_dcc->channel == channel)
+ ptr_dcc->channel = NULL;
+ }
+}
+
+/*
* dcc_recv_connect_init: connect to sender and init file or chat
*/
diff --git a/src/irc/irc.h b/src/irc/irc.h
index 898188608..dfab3e766 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -406,6 +406,7 @@ extern void nick_print_log (t_irc_nick *);
extern void dcc_redraw (int);
extern void dcc_free (t_irc_dcc *);
extern void dcc_close (t_irc_dcc *, int);
+extern void dcc_chat_remove_channel (t_irc_channel *);
extern void dcc_accept (t_irc_dcc *);
extern void dcc_accept_resume (t_irc_server *, char *, int, unsigned long);
extern void dcc_start_resume (t_irc_server *, char *, int, unsigned long);
diff --git a/weechat/src/gui/gui-buffer.c b/weechat/src/gui/gui-buffer.c
index 3f7107bc3..c57207384 100644
--- a/weechat/src/gui/gui-buffer.c
+++ b/weechat/src/gui/gui-buffer.c
@@ -435,6 +435,10 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
if (buffer->type == BUFFER_TYPE_RAW_DATA)
gui_buffer_raw_data = NULL;
+
+ /* purge DCC chat using this buffer */
+ if (CHANNEL(buffer))
+ dcc_chat_remove_channel (CHANNEL(buffer));
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
diff --git a/weechat/src/irc/irc-dcc.c b/weechat/src/irc/irc-dcc.c
index 11d28cf8b..378625b8e 100644
--- a/weechat/src/irc/irc-dcc.c
+++ b/weechat/src/irc/irc-dcc.c
@@ -510,6 +510,25 @@ dcc_channel_for_chat (t_irc_dcc *ptr_dcc)
}
/*
+ * dcc_chat_remove_channel: remove a buffer for DCC chat
+ */
+
+void
+dcc_chat_remove_channel (t_irc_channel *channel)
+{
+ t_irc_dcc *ptr_dcc;
+
+ if (!channel)
+ return;
+
+ for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
+ {
+ if (ptr_dcc->channel == channel)
+ ptr_dcc->channel = NULL;
+ }
+}
+
+/*
* dcc_recv_connect_init: connect to sender and init file or chat
*/
diff --git a/weechat/src/irc/irc.h b/weechat/src/irc/irc.h
index 898188608..dfab3e766 100644
--- a/weechat/src/irc/irc.h
+++ b/weechat/src/irc/irc.h
@@ -406,6 +406,7 @@ extern void nick_print_log (t_irc_nick *);
extern void dcc_redraw (int);
extern void dcc_free (t_irc_dcc *);
extern void dcc_close (t_irc_dcc *, int);
+extern void dcc_chat_remove_channel (t_irc_channel *);
extern void dcc_accept (t_irc_dcc *);
extern void dcc_accept_resume (t_irc_server *, char *, int, unsigned long);
extern void dcc_start_resume (t_irc_server *, char *, int, unsigned long);