Skip to content

Commit ebfcfb0

Browse files
committed
App crash fixed when using multiple app instances
1 parent 339d2a2 commit ebfcfb0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Source/NETworkManager/App.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,14 @@ private void Application_Startup(object sender, StartupEventArgs e)
6060

6161
// Single instance
6262
_mutex = new Mutex(true, "{" + Guid + "}");
63+
bool mutexIsAcquired = _mutex.WaitOne(TimeSpan.Zero, true);
6364

64-
if (SettingsManager.Current.Window_MultipleInstances || _mutex.WaitOne(TimeSpan.Zero, true))
65+
if (SettingsManager.Current.Window_MultipleInstances || mutexIsAcquired)
6566
{
6667
StartupUri = new Uri("MainWindow.xaml", UriKind.Relative);
67-
_mutex.ReleaseMutex();
68+
69+
if (mutexIsAcquired)
70+
_mutex.ReleaseMutex();
6871
}
6972
else
7073
{

0 commit comments

Comments
 (0)