Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(navigator): notifier connection should be disconnected #969

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading