From 8875c167d7f1e26f2db2a06522806a2ba0e7a6b5 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 1 May 2010 11:15:16 +0200 Subject: [PATCH] Fix crash with hook_process (when timer is called on a deleted hook process) --- ChangeLog | 4 +++- src/core/wee-hook.c | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 047512305..60174503a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ WeeChat ChangeLog ================= FlashCode -v0.3.3-dev, 2010-04-28 +v0.3.3-dev, 2010-05-01 Version 0.3.3 (under dev!) @@ -9,6 +9,8 @@ Version 0.3.3 (under dev!) * core: add keys for undo/redo changes on command line (default: ctrl/alt + underscore) (task #9483) +* core: fix crash with hook_process (when timer is called on a deleted hook + process) * irc: add new options irc.network.autoreconnect_delay_growing and irc.network.autoreconnect_delay_max (task #10338) * irc: add new option irc.color.item_buffer_name_ssl (task #10339) diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c index 72a0e31a5..2a0384607 100644 --- a/src/core/wee-hook.c +++ b/src/core/wee-hook.c @@ -1290,6 +1290,9 @@ hook_process_child_read (struct t_hook *hook_process, int fd, char buffer[4096]; int num_read; + if (hook_process->deleted) + return; + num_read = read (fd, buffer, sizeof (buffer) - 1); if (num_read > 0) { @@ -1355,6 +1358,9 @@ hook_process_timer_cb (void *arg_hook_process, int remaining_calls) hook_process = (struct t_hook *)arg_hook_process; + if (hook_process->deleted) + return WEECHAT_RC_OK; + if (remaining_calls == 0) { gui_chat_printf (NULL,