1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 13:26:38 +02:00

trigger: remove the timer hook pointer during the last timer call

This commit is contained in:
Sebastien Helleu
2014-01-31 16:18:03 +01:00
parent 1496c8a25c
commit a09e46f456
2 changed files with 16 additions and 2 deletions
+14 -1
View File
@@ -645,7 +645,7 @@ trigger_callback_timer_cb (void *data, int remaining_calls)
struct t_trigger *trigger;
struct t_hashtable *extra_vars;
char str_temp[128];
int rc;
int rc, i;
time_t date;
struct tm *date_tmp;
@@ -654,6 +654,19 @@ trigger_callback_timer_cb (void *data, int remaining_calls)
if (!trigger || trigger->hook_running)
return WEECHAT_RC_OK;
/*
* remove the hook if this is the last call to timer
* (because WeeChat will remove the hook after this call, so the pointer
* will become invalid)
*/
if ((remaining_calls == 0) && trigger->hooks)
{
for (i = 0; i < trigger->hooks_count; i++)
{
trigger->hooks[i] = NULL;
}
}
trigger->hook_count_cb++;
trigger->hook_running = 1;