Skip to content

Commit b34e4ac

Browse files
ksqsflotem
authored andcommitted
fix(navigator): disconnect notifier
1 parent 3a8ed90 commit b34e4ac

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/rime/gear/navigator.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,14 @@ Navigator::Navigator(const Ticket& ticket)
6161
LoadConfig(config, "navigator", Horizontal);
6262
LoadConfig(config, "navigator/vertical", Vertical);
6363

64-
engine_->context()->select_notifier().connect(
64+
select_connection_ = engine_->context()->select_notifier().connect(
6565
[this](Context* ctx) { OnSelect(ctx); });
6666
}
6767

68+
Navigator::~Navigator() {
69+
select_connection_.disconnect();
70+
}
71+
6872
ProcessResult Navigator::ProcessKeyEvent(const KeyEvent& key_event) {
6973
if (key_event.release())
7074
return kNoop;

src/rime/gear/navigator.h

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Navigator : public Processor, public KeyBindingProcessor<Navigator, 2> {
2323
};
2424

2525
explicit Navigator(const Ticket& ticket);
26+
virtual ~Navigator();
2627

2728
ProcessResult ProcessKeyEvent(const KeyEvent& key_event) override;
2829

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

4748
string input_;
4849
Spans spans_;
50+
51+
connection select_connection_;
4952
};
5053

5154
} // namespace rime

0 commit comments

Comments
 (0)