Skip to content

Commit

Permalink
refactor: use a boolean instead of the Lock object
Browse files Browse the repository at this point in the history
  • Loading branch information
erikian committed Jul 22, 2023
1 parent 293c069 commit 4d2f516
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/renderer/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ export class AppState {
});
}

// Lock on the active Electron version that prevents other windows from removing it
private versionLock: Lock | null = null;
// Do we have a lock on the active Electron version that prevents other windows from removing it?
private hasActiveLock = false;

// Used to release the lock when the current window switches Electron versions
private versionLockController = new AbortController();
Expand Down Expand Up @@ -989,7 +989,7 @@ export class AppState {
return;
}

if (this.versionLock) {
if (this.hasActiveLock) {
console.log(`Releasing lock on version ${this.version}`);

// release the lock on the previous version
Expand All @@ -1007,7 +1007,7 @@ export class AppState {
this.getVersionLockName(version),
{ mode: 'shared' },
(lock) => {
this.versionLock = lock;
this.hasActiveLock = Boolean(lock);

/**
* The lock is released when this promise resolves, so we keep it in the
Expand Down

0 comments on commit 4d2f516

Please sign in to comment.