qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Moving alarm_timer assignment before atexit()


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] Moving alarm_timer assignment before atexit()
Date: Thu, 8 Aug 2013 10:19:55 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Aug 07, 2013 at 04:17:29PM +0800, Amos Kong wrote:
> BTW, can we add a check in quit_timers() to avoid one kind of crash
> (try to quit the uninited timers, or quit timer repeatedly) ?
> 
> 
> diff --git a/qemu-timer.c b/qemu-timer.c
> index b2d95e2..023e4ae 100644
> --- a/qemu-timer.c
> +++ b/qemu-timer.c
> @@ -728,8 +728,10 @@ static void win32_rearm_timer(struct
> qemu_alarm_timer *t,
>  static void quit_timers(void)
>  {
>      struct qemu_alarm_timer *t = alarm_timer;
> -    alarm_timer = NULL;
> -    t->stop(t);
> +    if (t) {
> +        alarm_timer = NULL;
> +        t->stop(t);
> +    }
>  }

This is unnecessary once your other patch has been applied since t will
be initialized before quit_timers() is installed.

If we do ever hit the problem it should be debugged because assumptions
about the timer lifecycle must be broken.  So avoiding the segfault
isn't really useful here, I think.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]