From 7b9edcf90caae3a3e52d250eea2c4f4c1baaae9c Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Wed, 20 Sep 2017 22:29:40 +0200 Subject: [PATCH] lxip: fix timer deletion and modification Linux del_timer() and mod_timer() return if the timer was pending before the modification. Additionally, these functions are potentially called from handler function of the timer to modify and, therefore, checking for timeout != INVALID_TIMEOUT is not sufficient as the timeout is indeed valid when the handler is executed. --- repos/dde_linux/src/lib/lxip/timer_handler.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repos/dde_linux/src/lib/lxip/timer_handler.cc b/repos/dde_linux/src/lib/lxip/timer_handler.cc index 61c289e8c3..9b19af79f7 100644 --- a/repos/dde_linux/src/lib/lxip/timer_handler.cc +++ b/repos/dde_linux/src/lib/lxip/timer_handler.cc @@ -230,7 +230,7 @@ class Lx::Timer if (!ctx) return 0; - int rv = ctx->timeout != Context::INVALID_TIMEOUT ? 1 : 0; + int rv = ctx->pending ? 1 : 0; _list.remove(ctx); destroy(&_timer_alloc, ctx); @@ -253,7 +253,7 @@ class Lx::Timer * If timer was already active return 1, otherwise 0. The return * value is needed by mod_timer(). */ - int rv = ctx->timeout != Context::INVALID_TIMEOUT ? 1 : 0; + int rv = ctx->pending ? 1 : 0; _schedule_timer(ctx, expires);