From 52196b7954532404ed8b67ec5a0cb12126c603c5 Mon Sep 17 00:00:00 2001 From: Michael Seibt Date: Thu, 26 Mar 2026 15:09:10 +0100 Subject: [PATCH] WT-14441: Avoid segfault on WApplication::setAsFocus during destruction and generally set quitted_ first on destruction --- src/Wt/WApplication.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Wt/WApplication.C b/src/Wt/WApplication.C index 14c330c99..a3af49162 100644 --- a/src/Wt/WApplication.C +++ b/src/Wt/WApplication.C @@ -391,6 +391,8 @@ std::string WApplication::onePixelGifUrl() WApplication::~WApplication() { + quitted_ = true; + #ifndef WT_TARGET_JAVA Configuration& conf = env().server()->configuration(); if (conf.servePrivateResourcesToBots() && env().agentIsSpiderBot()) { @@ -1147,6 +1149,8 @@ EventSignal<>& WApplication::globalEscapePressed() void WApplication::setAsFocus(const std::string& id) { + if (!root() || hasQuit()) + return; WWidget* w = root()->findById(id); if (w) { w->setFocus();