From 7d14afdb6fdfdfe80076a976454895f4fbcb5d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=97=AD?= Date: Mon, 21 Oct 2024 14:29:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A0=E9=99=90?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Magpie.App/ToastPage.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Magpie.App/ToastPage.cpp b/src/Magpie.App/ToastPage.cpp index ecb80a96f..40bd1d9bd 100644 --- a/src/Magpie.App/ToastPage.cpp +++ b/src/Magpie.App/ToastPage.cpp @@ -14,12 +14,10 @@ fire_and_forget ToastPage::ShowMessageOnWindow(hstring message, uint64_t hwndTar // !!! HACK !!! // 重用 TeachingTip 有一个 bug: 前一个 Toast 正在消失时新的 Toast 不会显示。为了 // 规避它,我们每次都创建新的 TeachingTip,但要保留旧对象的引用,因为播放动画时销毁 - // 会导致崩溃。oldTeachingTIp 的生存期可确保动画播放完毕。 + // 会导致崩溃。oldTeachingTip 的生存期可确保动画播放完毕。 MUXC::TeachingTip oldTeachingTip = MessageTeachingTip(); if (oldTeachingTip) { - // 先卸载再关闭,始终关闭 TeachingTip 确保调用者可以检查是否可见 UnloadObject(oldTeachingTip); - oldTeachingTip.IsOpen(false); } // 备份要使用的变量,后面避免使用 this @@ -128,7 +126,7 @@ fire_and_forget ToastPage::ShowMessageOnWindow(hstring message, uint64_t hwndTar 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOREDRAW ); - } while (curTeachingTip.IsOpen()); + } while (curTeachingTip.IsLoaded() && curTeachingTip.IsOpen()); } }