mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix a clipboard crash issues & don't default exit Wox when exception happens.
This commit is contained in:
parent
1d13943caf
commit
a30f60c2ba
2 changed files with 14 additions and 10 deletions
|
|
@ -49,8 +49,16 @@ namespace Wox.Plugin.SystemPlugins
|
|||
SubTitle = "Copy this number to the clipboard",
|
||||
Action = (c) =>
|
||||
{
|
||||
Clipboard.SetText(result.Result);
|
||||
return true;
|
||||
try
|
||||
{
|
||||
Clipboard.SetText(result.Result);
|
||||
return true;
|
||||
}
|
||||
catch (System.Runtime.InteropServices.ExternalException e)
|
||||
{
|
||||
MessageBox.Show("Copy failed, please try later");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,26 +27,22 @@ namespace Wox.Helper.ErrorReporting
|
|||
|
||||
public static void DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
if (System.Diagnostics.Debugger.IsAttached) return;
|
||||
if (Debugger.IsAttached) return;
|
||||
|
||||
e.Handled = true;
|
||||
string error = CreateExceptionReport("System.Windows.Application.DispatcherUnhandledException", e.Exception);
|
||||
|
||||
Log.Error(error);
|
||||
if (TryShowErrorMessageBox(error, e.Exception))
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
TryShowErrorMessageBox(error, e.Exception);
|
||||
}
|
||||
public static void ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
|
||||
{
|
||||
if (System.Diagnostics.Debugger.IsAttached) return;
|
||||
if (Debugger.IsAttached) return;
|
||||
|
||||
string error = CreateExceptionReport("System.Windows.Forms.Application.ThreadException", e.Exception);
|
||||
|
||||
Log.Fatal(error);
|
||||
TryShowErrorMessageBox(error, e.Exception);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
private static string CreateExceptionReport(string ev, object exceptionObject)
|
||||
|
|
@ -97,7 +93,7 @@ namespace Wox.Helper.ErrorReporting
|
|||
else
|
||||
{
|
||||
sb.AppendLine(exceptionObject.GetType().FullName);
|
||||
sb.AppendLine(new System.Diagnostics.StackTrace().ToString());
|
||||
sb.AppendLine(new StackTrace().ToString());
|
||||
sb.AppendLine("```");
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue