Commit 4bcbc78
committed
Fix coordinate conversion and resource leaks from code review
Coordinate conversion (SimpleViewModel.swift):
- Fixed multi-monitor coordinate conversion to use global maxY
- Previous per-screen logic was incorrect and caused wrong Y positions
- Now properly accounts for entire virtual screen space
Resource management (SimpleHotkeyManager.swift):
- Restored stopMonitoring() to MainActor with proper cleanup
- Fixed stopMouseMonitoring() to dispatch cleanup to MainActor
- Both methods now properly nil out monitor properties and callbacks
- Prevents memory leaks from retained closures in singleton
- Removed nonisolated(unsafe) annotations (no longer needed)
These fixes address all issues identified in code review.1 parent cbb0303 commit 4bcbc78
File tree
2 files changed
+31
-28
lines changed- Sources/ClickIt/Lite
2 files changed
+31
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
69 | 71 | | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| |||
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
99 | 108 | | |
100 | 109 | | |
101 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
143 | 137 | | |
144 | 138 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
149 | 143 | | |
150 | 144 | | |
151 | | - | |
| 145 | + | |
152 | 146 | | |
153 | 147 | | |
154 | 148 | | |
0 commit comments