From 1e48e3e40e0780c0cd07a3457e5fe2efeeb542d1 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 86f1af461e10..6203269a0779 100644 --- a/apps/gallery/js/gallery.js +++ b/apps/gallery/js/gallery.js @@ -1417,7 +1417,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); } } }