Skip to content

Commit 82de087

Browse files
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

3 files changed

+188
-234
lines changed

include/structor/synth_types.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class VTableDetector;
3434
class TypePropagator;
3535
class PseudocodeRewriter;
3636
class StructurePersistence;
37-
class UIIntegration;
3837

3938
// ============================================================================
4039
// Core Constants

0 commit comments

Comments
 (0)