fix: 更好的解决双击关闭按钮闪退问题

This commit is contained in:
Xu 2025-01-22 00:43:24 +08:00
commit f6a8e737bf

View file

@ -373,8 +373,8 @@ protected:
}
case WM_DESTROY:
{
// 防止双击关闭按钮时崩溃。崩溃发生在 XAML Islands 内部Win10 和 Win11 上都可以复现。
EnableWindow(this->Handle(), FALSE);
// 确保关闭过程中 _content 已经为空
_content = nullptr;
_xamlSourceNative2 = nullptr;
// 必须手动重置 Content否则会内存泄露使 RootPage 无法析构
@ -386,8 +386,6 @@ protected:
_isMaximized = false;
_isLightTheme = true;
_content = nullptr;
Destroyed.Invoke();
LRESULT ret = base_type::_MessageHandler(msg, wParam, lParam);