summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2016-04-05 18:17:26 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2016-04-06 13:34:32 +0200
commitedd1a409f879f74193c2789f50240005bcf00783 (patch)
tree3edd04700b665f77d84f06f1251a2650db2c8ca5
parent76fd0a374f6879fba6f1d281d06003937ad4980c (diff)
xspice: Don't create Xorg time in timer_add
SpiceCoreInterface::timer_add() is used by spice-server for integration with external mainloops. timer_add() is only meant to create a disabled timer, this timer will then be started with a call to timer_start(). The current implementation in Xspice creates a timer which will trigger in a very long time, assuming this will never happen. This 'forever' is 1,000,000 seconds, which amounts to 11 days. After that time, some timers which are meant to be disabled (eg migration related timers in spice-server) fire, then causing a crash with some failed assertions. Instead of creating the X timer right away in timer_add(), we can wait until timer_start() is called before starting it, which avoids this issue.
-rw-r--r--src/spiceqxl_main_loop.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/spiceqxl_main_loop.c b/src/spiceqxl_main_loop.c
index ac9e43f..db89b6d 100644
--- a/src/spiceqxl_main_loop.c
+++ b/src/spiceqxl_main_loop.c
@@ -171,7 +171,6 @@ static SpiceTimer* timer_add(SpiceTimerFunc func, void *opaque)
{
SpiceTimer *timer = calloc(sizeof(SpiceTimer), 1);
- timer->xorg_timer = TimerSet(NULL, 0, 1e9 /* TODO: infinity? */, xorg_timer_callback, timer);
timer->func = func;
timer->opaque = opaque;
return timer;
@@ -179,7 +178,8 @@ static SpiceTimer* timer_add(SpiceTimerFunc func, void *opaque)
static void timer_start(SpiceTimer *timer, uint32_t ms)
{
- TimerSet(timer->xorg_timer, 0 /* flags */, ms, xorg_timer_callback, timer);
+ timer->xorg_timer = TimerSet(timer->xorg_timer, 0 /* flags */,
+ ms, xorg_timer_callback, timer);
}
static void timer_cancel(SpiceTimer *timer)