mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
fixed #1462: Try catch IPC issues
This commit is contained in:
parent
830d6b2aec
commit
7a8547208e
1 changed files with 37 additions and 23 deletions
|
@ -58,7 +58,7 @@ public ApplicationInstanceManager(bool isSingleInstance, string[] args, EventHan
|
|||
|
||||
if (IsSingleInstance && !IsFirstInstance)
|
||||
{
|
||||
CreateMultipleInstance(callback, args);
|
||||
CreateMultipleInstance(args);
|
||||
}
|
||||
}
|
||||
catch (AbandonedMutexException)
|
||||
|
@ -93,6 +93,8 @@ public void Dispose()
|
|||
}
|
||||
|
||||
private void CreateFirstInstance(EventHandler<InstanceCallbackEventArgs> callback)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool createdNew;
|
||||
|
||||
|
@ -112,8 +114,15 @@ private void CreateFirstInstance(EventHandler<InstanceCallbackEventArgs> callbac
|
|||
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;
|
||||
|
||||
|
@ -128,6 +137,11 @@ private void CreateMultipleInstance(EventHandler<InstanceCallbackEventArgs> call
|
|||
eventWaitHandle.Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e);
|
||||
}
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue