fixed #1462: Try catch IPC issues

This commit is contained in:
Jaex 2016-03-29 13:43:30 +03:00
parent 830d6b2aec
commit 7a8547208e

View file

@ -58,7 +58,7 @@ public ApplicationInstanceManager(bool isSingleInstance, string[] args, EventHan
if (IsSingleInstance && !IsFirstInstance) if (IsSingleInstance && !IsFirstInstance)
{ {
CreateMultipleInstance(callback, args); CreateMultipleInstance(args);
} }
} }
catch (AbandonedMutexException) catch (AbandonedMutexException)
@ -93,6 +93,8 @@ public void Dispose()
} }
private void CreateFirstInstance(EventHandler<InstanceCallbackEventArgs> callback) private void CreateFirstInstance(EventHandler<InstanceCallbackEventArgs> callback)
{
try
{ {
bool createdNew; bool createdNew;
@ -112,8 +114,15 @@ private void CreateFirstInstance(EventHandler<InstanceCallbackEventArgs> callbac
RegisterRemoteType(AppName); RegisterRemoteType(AppName);
} }
} }
catch (Exception e)
{
DebugHelper.WriteException(e);
}
}
private void CreateMultipleInstance(EventHandler<InstanceCallbackEventArgs> callback, string[] args) private void CreateMultipleInstance(string[] args)
{
try
{ {
InstanceProxy.CommandLineArgs = args; InstanceProxy.CommandLineArgs = args;
@ -128,6 +137,11 @@ private void CreateMultipleInstance(EventHandler<InstanceCallbackEventArgs> call
eventWaitHandle.Set(); eventWaitHandle.Set();
} }
} }
}
catch (Exception e)
{
DebugHelper.WriteException(e);
}
Environment.Exit(0); Environment.Exit(0);
} }