From 5f5bd567014d423ad858049090e8dccc83d3ab62 Mon Sep 17 00:00:00 2001 From: Liu Zheng Date: Wed, 26 Nov 2025 14:00:31 +0800 Subject: [PATCH] replace delete this with safe async deletion in IBusInputContext The previous code used 'delete this' in a service watcher callback, causing use-after-free when D-Bus clients disconnect unexpectedly. --- src/frontend/ibusfrontend/ibusfrontend.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/ibusfrontend/ibusfrontend.cpp b/src/frontend/ibusfrontend/ibusfrontend.cpp index 6d7ee3bdc..36fc51494 100644 --- a/src/frontend/ibusfrontend/ibusfrontend.cpp +++ b/src/frontend/ibusfrontend/ibusfrontend.cpp @@ -343,7 +343,9 @@ class IBusInputContext : public InputContext, [this](const std::string &, const std::string &, const std::string &newName) { if (newName.empty()) { - delete this; + im_->instance()->eventDispatcher().schedule([this]() { + delete this; + }); } })), name_(sender) {