1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-08 10:43:13 +02:00

relay: fix crash when closing relay buffers (closes #57, closes #78)

A flag "closing" has been added in buffers. It is set to 1 when the buffer
is closing, and then no more printf is allowed in the buffer (a message
printed on relay buffer was causing a crash when it is closed).
This commit is contained in:
Sébastien Helleu
2014-05-24 18:57:29 +02:00
parent faae8f470b
commit 02eed97d97
4 changed files with 28 additions and 11 deletions
+9 -3
View File
@@ -644,10 +644,10 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
char *modifier_data, *new_msg, *ptr_msg, *lines_waiting;
struct t_gui_line *ptr_line;
if (!gui_buffer_valid (buffer))
if (!message)
return;
if (!message)
if (!gui_buffer_valid (buffer))
return;
if (gui_init_ok)
@@ -655,7 +655,7 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
if (!buffer)
buffer = gui_buffer_search_main ();
if (!buffer)
if (!buffer || buffer->closing)
return;
if (buffer->type != GUI_BUFFER_TYPE_FORMATTED)
@@ -842,11 +842,17 @@ gui_chat_printf_y (struct t_gui_buffer *buffer, int y, const char *message, ...)
struct t_gui_line *ptr_line;
int i, num_lines_to_add;
if (!gui_buffer_valid (buffer))
return;
if (gui_init_ok)
{
if (!buffer)
buffer = gui_buffer_search_main ();
if (!buffer || buffer->closing)
return;
if (buffer->type != GUI_BUFFER_TYPE_FREE)
buffer = gui_buffers;