Skip to content

Commit 53dc652

Browse files
Fix mutex release in exception handling to ensure proper resource management
1 parent cf160d2 commit 53dc652

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/SshAgentEcho.Gui/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public static void Main(string[] args) {
2626
.StartWithClassicDesktopLifetime(args);
2727
} catch (NullReferenceException ex) when (ex.StackTrace?.Contains("DBusMenu") == true || ex.StackTrace?.Contains("Tmds.DBus") == true) {
2828
Console.WriteLine($"Suppressing DBus shutdown error: {ex.Message}");
29+
} catch (Exception ex) {
30+
Console.WriteLine($"Unhandled exception: {ex}");
31+
} finally {
32+
_mutex.ReleaseMutex();
2933
}
3034
}
3135

0 commit comments

Comments
 (0)