From 7dd6836fa10a2c529164b8b48e8867579517da9c Mon Sep 17 00:00:00 2001 From: ksqsf Date: Thu, 2 Jan 2025 22:08:18 +0100 Subject: [PATCH] fix(navigator): disconnect notifier --- src/rime/gear/navigator.cc | 6 +++++- src/rime/gear/navigator.h | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rime/gear/navigator.cc b/src/rime/gear/navigator.cc index c3a6362157..e3c3b40e36 100644 --- a/src/rime/gear/navigator.cc +++ b/src/rime/gear/navigator.cc @@ -61,10 +61,14 @@ Navigator::Navigator(const Ticket& ticket) LoadConfig(config, "navigator", Horizontal); LoadConfig(config, "navigator/vertical", Vertical); - engine_->context()->select_notifier().connect( + select_connection_ = engine_->context()->select_notifier().connect( [this](Context* ctx) { OnSelect(ctx); }); } +Navigator::~Navigator() { + select_connection_.disconnect(); +} + ProcessResult Navigator::ProcessKeyEvent(const KeyEvent& key_event) { if (key_event.release()) return kNoop; diff --git a/src/rime/gear/navigator.h b/src/rime/gear/navigator.h index f6205e8ba2..0ec370b508 100644 --- a/src/rime/gear/navigator.h +++ b/src/rime/gear/navigator.h @@ -23,6 +23,7 @@ class Navigator : public Processor, public KeyBindingProcessor { }; explicit Navigator(const Ticket& ticket); + virtual ~Navigator(); ProcessResult ProcessKeyEvent(const KeyEvent& key_event) override; @@ -46,6 +47,8 @@ class Navigator : public Processor, public KeyBindingProcessor { string input_; Spans spans_; + + connection select_connection_; }; } // namespace rime