Add upgrade locking mechanism to core ui serving module

This commit is contained in:
Daniel
2025-04-07 15:26:35 +02:00
parent b1bc5e2d0e
commit 438f43156f
7 changed files with 122 additions and 86 deletions

View File

@@ -20,6 +20,7 @@ import (
"github.com/safing/portmaster/base/utils"
"github.com/safing/portmaster/service/configure"
"github.com/safing/portmaster/service/mgr"
"github.com/safing/portmaster/service/ui"
)
const (
@@ -645,4 +646,5 @@ type instance interface {
Restart()
Shutdown()
Notifications() *notifications.Notifications
UI() *ui.UI
}

View File

@@ -24,6 +24,10 @@ func (u *Updater) upgrade(downloader *Downloader, ignoreVersion bool) error {
}
}
// Unload UI assets to be able to move files on Windows.
u.instance.UI().EnableUpgradeLock()
defer u.instance.UI().DisableUpgradeLock()
// Execute the upgrade.
upgradeError := u.upgradeMoveFiles(downloader)
if upgradeError == nil {