Skip to content

Commit 734c5bb

Browse files
committed
Fix lock release issue
1 parent 87aca2f commit 734c5bb

File tree

1 file changed

+13
-3
lines changed
  • Plugins/Flow.Launcher.Plugin.Program

1 file changed

+13
-3
lines changed

Plugins/Flow.Launcher.Plugin.Program/Main.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
367367
Title = Context.API.GetTranslation("flowlauncher_plugin_program_disable_program"),
368368
Action = c =>
369369
{
370-
DisableProgram(program);
370+
_ = DisableProgramAsync(program);
371371
Context.API.ShowMsg(
372372
Context.API.GetTranslation("flowlauncher_plugin_program_disable_dlgtitle_success"),
373373
Context.API.GetTranslation(
@@ -383,7 +383,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
383383
return menuOptions;
384384
}
385385

386-
private static async Task DisableProgram(IProgram programToDelete)
386+
private static async Task DisableProgramAsync(IProgram programToDelete)
387387
{
388388
if (_settings.DisabledProgramSources.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
389389
return;
@@ -403,7 +403,12 @@ private static async Task DisableProgram(IProgram programToDelete)
403403
});
404404
return;
405405
}
406-
406+
else
407+
{
408+
// Release the lock if we cannot find the program
409+
_uwpsLock.Release();
410+
}
411+
407412
await _win32sLock.WaitAsync();
408413
if (_win32s.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
409414
{
@@ -418,6 +423,11 @@ private static async Task DisableProgram(IProgram programToDelete)
418423
_ = IndexWin32ProgramsAsync();
419424
});
420425
}
426+
else
427+
{
428+
// Release the lock if we cannot find the program
429+
_win32sLock.Release();
430+
}
421431
}
422432

423433
public static void StartProcess(Func<ProcessStartInfo, Process> runProcess, ProcessStartInfo info)

0 commit comments

Comments
 (0)