Skip to content

Added member xxx_notify() to class Context and catch exception to stop the propagation#1066

Open
shewer wants to merge 49 commits intorime:masterfrom
shewer:notify
Open

Added member xxx_notify() to class Context and catch exception to stop the propagation#1066
shewer wants to merge 49 commits intorime:masterfrom
shewer:notify

Conversation

@shewer
Copy link
Contributor

@shewer shewer commented Aug 30, 2025

Pull request

Added member xxx_notify() to class Context and catch exception to stop the propagation

Issue tracker

Fixes will automatically close the related issue

Fixes #

Feature

Describe feature of pull request

Unit test

  • Done

Manual test

  • Done

Code Review

  1. Unit and manual test pass
  2. GitHub Action CI pass
  3. At least one contributor reviews and votes
  4. Can be merged clean without conflicts
  5. PR will be merged by rebase upstream base

Additional Info

1 class StopSlotException : public std::runtime_error
2 stop propagation when catch StopSlotException
3 added member in class Context
. commit_notify()
. update_notify()
. select_notify()
. abort_notify()
. option_update_notify(const string&)
. property_update_notify(const string&)
. unhandled_key_notify(const KeyEvent&)

shewer added 30 commits January 20, 2023 16:48
Signed-off-by: shewer <shewer@gmail.com>
Signed-off-by: shewer <shewer@gmail.com>
Signed-off-by: shewer <shewer@gmail.com>
Signed-off-by: shewer <shewer@gmail.com>
@lotem
Copy link
Member

lotem commented Sep 24, 2025

可能有一定幫助吧。但是我也注意到 update_notifier() 等這一系列 getter 已經把 Notifier 對象暴露給其他組件了。
PR 裏的修改只能管住 Context 類的發的通知,管不住其他代碼發的通知。有沒有辦法?

Signed-off-by: shewer <shewer@gmail.com>
@shewer
Copy link
Contributor Author

shewer commented Oct 24, 2025

可能有一定幫助吧。但是我也注意到 update_notifier() 等這一系列 getter 已經把 Notifier 對象暴露給其他組件了。 PR 裏的修改只能管住 Context 類的發的通知,管不住其他代碼發的通知。有沒有辦法?

已在 Context 加入 connect method 了, 也改了librime 中中有使用 notify 的code , 但沒有移除 notifier 外露 ,因為librime-lua script 還有在使用 notifier

@lotem
Copy link
Member

lotem commented Oct 28, 2025

我刚刚看明白这个不是防范异常的。

@lotem
Copy link
Member

lotem commented Oct 28, 2025

究竟要做什么,请讲讲。

如果要实现某个功能,我想了解这个功能的完整设计。
只见到你设计好的一套实现,我无法判断这种实现能否有效应对现实中的问题、是否最优设计。

@shewer
Copy link
Contributor Author

shewer commented Oct 28, 2025

原本只是要增加 Context notify 的接口,你提議想把 notifier 封裝起來,所以我再加上connect 接口.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants