# Fixed shutdown after user inactivity in case a plugin is keeping the OSD open.
#
--- a/vdr.c	2018/04/28 11:27:48	5.1
+++ b/vdr.c	2018/07/16 08:52:40	5.2
@@ -1514,9 +1514,7 @@
               ShutdownHandler.countdown.Cancel();
            }
 
-        if ((Now - LastInteract) > ACTIVITYTIMEOUT && !cRecordControls::Active() && !RecordingsHandler.Active() && (Now - cRemote::LastActivity()) > ACTIVITYTIMEOUT) {
-           // Handle housekeeping tasks
-
+        if (!cRecordControls::Active() && !RecordingsHandler.Active() && (Now - cRemote::LastActivity()) > ACTIVITYTIMEOUT) {
            // Shutdown:
            // Check whether VDR will be ready for shutdown in SHUTDOWNWAIT seconds:
            time_t Soon = Now + SHUTDOWNWAIT;
@@ -1535,7 +1533,8 @@
               // Do this again a bit later:
               ShutdownHandler.SetRetry(SHUTDOWNRETRY);
               }
-
+           // Handle housekeeping tasks
+           if ((Now - LastInteract) > ACTIVITYTIMEOUT) {
            // Disk housekeeping:
            RemoveDeletedRecordings();
            ListGarbageCollector.Purge();
@@ -1543,6 +1542,7 @@
            // Plugins housekeeping:
            PluginManager.Housekeeping();
            }
+           }
 
         ReportEpgBugFixStats();
 
