Commit 82de087
committed
refactor: Replace UIIntegration singleton with stateless namespace functions
This commit dismantles the `UIIntegration` singleton class, refactoring its functionality into a set of stateless free functions within the `ui` namespace. This change decouples the UI logic from the lifecycle management of the action handler, resolving ownership ambiguities.
- include/structor/ui_integration.hpp (modified):
- Removed the `UIIntegration` singleton class entirely.
- Introduced `namespace ui` to house static UI logic (`initialize`, `shutdown`, `execute_synthesis`).
- Changed `initialize()` to accept an external `SynthActionHandler*` rather than instantiating one internally.
- Converted `HexRaysHooks` from a class to a struct.
- src/plugin.cpp (modified):
- `StructorPlugin` now explicitly owns the `SynthActionHandler` instance as a member variable.
- Updated initialization and cleanup calls to use the new `ui::` namespace functions.
- Passes the plugin-owned handler to `ui::initialize`, ensuring the handler's lifetime is bound to the plugin instance (`plugmod_t`).
- include/structor/synth_types.hpp (modified):
- Removed forward declaration of `UIIntegration`.
Impact:
- No user-visible behavioral changes.
- Improves architectural robustness by ensuring the `SynthActionHandler` is destroyed when the plugin is unloaded, preventing potential use-after-free issues associated with the previous singleton pattern.
- Simplifies the UI integration API by removing unnecessary object state.1 parent ba48dbd commit 82de087
File tree
3 files changed
+188
-234
lines changed- include/structor
- src
3 files changed
+188
-234
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
| |||
0 commit comments