From 995591d2071ac8189960a88119def1ee86b5cfde Mon Sep 17 00:00:00 2001 From: David Flanagan Date: Thu, 16 Oct 2014 16:24:04 -0700 Subject: [PATCH] Bug 1062114: double-check that we're still hidden before exiting --- apps/gallery/js/gallery.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/gallery/js/gallery.js b/apps/gallery/js/gallery.js index f41f0f977b81..edb6758a570f 100644 --- a/apps/gallery/js/gallery.js +++ b/apps/gallery/js/gallery.js @@ -1429,7 +1429,14 @@ function doNotScanInBackgroundHack(photodb) { // wait a bit for the log to be flushed, and then close the application if (document.hidden && photodb.scanning) { console.warn('[Gallery] exiting to avoid background scan.'); - setTimeout(function() { window.close(); }, 500); + setTimeout(function() { + if (document.hidden) { + window.close(); + } + else { + console.warn('[Gallery] now visible again, so not exiting'); + } + }, 500); } } }