Skip to content

Commit

Permalink
fix(navigator): disconnect notifier
Browse files Browse the repository at this point in the history
  • Loading branch information
ksqsf authored and lotem committed Jan 2, 2025
1 parent 3a8ed90 commit b34e4ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/rime/gear/navigator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/rime/gear/navigator.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Navigator : public Processor, public KeyBindingProcessor<Navigator, 2> {
};

explicit Navigator(const Ticket& ticket);
virtual ~Navigator();

ProcessResult ProcessKeyEvent(const KeyEvent& key_event) override;

Expand All @@ -46,6 +47,8 @@ class Navigator : public Processor, public KeyBindingProcessor<Navigator, 2> {

string input_;
Spans spans_;

connection select_connection_;
};

} // namespace rime
Expand Down

0 comments on commit b34e4ac

Please sign in to comment.