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); } } }