From 4b9f3cb369a556e22b282f73b6cba966a7381b4c Mon Sep 17 00:00:00 2001 From: Richard Stanway Date: Mon, 3 Feb 2020 22:42:00 +0100 Subject: [PATCH] UI: Always prompt when updates are available The current updater code won't prompt the user if an output is active or if game capture is in use. These are both fairly common situations to be in as soon as OBS starts up - for example, the NDI and VirtualCam plugins both start outputs automatically, and a game capture source will hook if the game is open. It should be fairly obvious to a user that OBS will be closed when an update is installed. Given the low frequency of game capture updates, the risk of an update encountering in-use files is also very low, and the standalone updater UI already shows a prompt should this happen. --- UI/win-update/win-update.cpp | 49 ------------------------------------ 1 file changed, 49 deletions(-) diff --git a/UI/win-update/win-update.cpp b/UI/win-update/win-update.cpp index 00d891e83..06566daec 100644 --- a/UI/win-update/win-update.cpp +++ b/UI/win-update/win-update.cpp @@ -503,26 +503,6 @@ int AutoUpdateThread::queryUpdate(bool localManualUpdate, const char *text_utf8) return ret; } -static bool IsFileInUse(const wstring &file) -{ - WinHandle f = CreateFile(file.c_str(), GENERIC_WRITE, 0, nullptr, - OPEN_EXISTING, 0, nullptr); - if (!f.Valid()) { - int err = GetLastError(); - if (err == ERROR_SHARING_VIOLATION || - err == ERROR_LOCK_VIOLATION) - return true; - } - - return false; -} - -static bool IsGameCaptureInUse() -{ - wstring path = L"..\\..\\data\\obs-plugins\\win-capture\\graphics-hook"; - return IsFileInUse(path + L"32.dll") || IsFileInUse(path + L"64.dll"); -} - void AutoUpdateThread::run() try { long responseCode; @@ -546,29 +526,6 @@ try { BPtr manifestPath = GetConfigPathPtr("obs-studio\\updates\\manifest.json"); - auto ActiveOrGameCaptureLocked = [this]() { - if (obs_video_active()) { - if (manualUpdate) - info(QTStr("Updater.Running.Title"), - QTStr("Updater.Running.Text")); - return true; - } - if (IsGameCaptureInUse()) { - if (manualUpdate) - info(QTStr("Updater.GameCaptureActive.Title"), - QTStr("Updater.GameCaptureActive.Text")); - return true; - } - - return false; - }; - - /* ----------------------------------- * - * warn if running or gc locked */ - - if (ActiveOrGameCaptureLocked()) - return; - /* ----------------------------------- * * create signature provider */ @@ -665,12 +622,6 @@ try { if (!manualUpdate && updateVer == skipUpdateVer) return; - /* ----------------------------------- * - * warn again if running or gc locked */ - - if (ActiveOrGameCaptureLocked()) - return; - /* ----------------------------------- * * fetch updater module */