Skip to content

Commit

Permalink
🐛 MacOS Substring内存溢出 改用 TrimStart 已测试通过
Browse files Browse the repository at this point in the history
  • Loading branch information
Mossimos committed Nov 11, 2023
1 parent 2b18e03 commit 72f301d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private async void Current_UrlsOpened(object? sender, UrlOpenedEventArgs e)
var loginUrl = e.Urls.Where(x => x.StartsWith(Constants.UrlSchemes.Login)).FirstOrDefault();
if (loginUrl != null)
{
var token = loginUrl.Substring(Constants.UrlSchemes.Login.Length, loginUrl.Length - 1);
var token = loginUrl.TrimStart(Constants.UrlSchemes.Login);
await ThirdPartyLoginHelper.OnMessageAsync(token);
}
}
Expand All @@ -70,11 +70,11 @@ protected override void OnDataContextChanged(EventArgs e)

protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
{
Application.Current!.UrlsOpened -= Current_UrlsOpened;
base.OnDetachedFromVisualTree(e);
if (DataContext is LoginOrRegisterWindowViewModel vm)
{
vm.RemoveAllDelegate();
}
Application.Current!.UrlsOpened -= Current_UrlsOpened;
}
}

0 comments on commit 72f301d

Please sign in to comment.