fix: 原生窗口销毁后宿主事件循环未退出

This commit is contained in:
Codex
2026-10-05 00:51:43 +08:00
parent 568ffc40eb
commit c0eca1d4bd
5 changed files with 125 additions and 7 deletions
+14
View File
@@ -88,6 +88,15 @@ int main(int argc, char** argv)
button->setTooltipText("stationary tip");
window.addControl(std::move(button));
}
else if (scenario == "native-close")
{
// 只创建顶层窗口,由 UI 驱动发送原生关闭命令并验证宿主循环自行退出。
}
else if (scenario == "modal-close")
{
// 窗口首次绘制后立即进入真正的模态循环,由 UI 驱动关闭宿主原生窗口。
// 该场景用于验证模态循环不会在 HWND 已销毁后继续轮询。
}
else if (scenario == "tab")
{
// 两个页签故意使用相同标题,验证索引身份而不是文本匹配决定激活状态。
@@ -166,5 +175,10 @@ int main(int argc, char** argv)
}
window.draw();
if (scenario == "modal-close")
{
(void)StellarX::MessageBox::showModal(
window, "close the native host window", "modal close", StellarX::MessageBoxType::OK);
}
return window.runEventLoop();
}