From 42249602520c0ba0f0f82f7e5fb4d856c2f03983 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 17 Jun 2013 11:30:31 -0700 Subject: [PATCH] Fixed another potential timer leak when closing a viewer If the viewer was closed in response to an event raised during the update function, the timer would have continued running. --- src/viewer.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index 624431e4..f328e01e 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1468,8 +1468,11 @@ function updateMulti( viewer ) { beginTime = +new Date(); updateOnce( viewer ); - THIS[ viewer.hash ].updateRequestId = scheduleUpdate( viewer, - arguments.callee, beginTime ); + // Request the next frame, unless we've been closed during the updateOnce() + if ( viewer.source ) { + THIS[ viewer.hash ].updateRequestId = scheduleUpdate( viewer, + arguments.callee, beginTime ); + } } function updateOnce( viewer ) {