Commit f1ad680
fix(progress): use update_idletasks() to avoid reentrant event dispatch
ProgressWindow.update_progress_bar() and the inline progress bar in
FlightControllerInfoWindow.update_progress_bar() both called
self.progress_bar.update() to refresh the display. tkinter's update()
pumps the entire event queue, including any user clicks that arrived
against other windows while a long blocking call (parameter upload, FC
connection, parameter download, motor reset) was holding the main
thread. Those queued click handlers fire reentrantly while the caller
is still mid-operation, which can:
- retrigger an upload/download whose state machine is not yet idle
- close or rebuild widgets the caller still holds references to
- dispatch destructor paths on a window the caller will dereference
Switch both call sites to update_idletasks(), which only flushes
geometry/repaint events and does not run user-event handlers. The
visible refresh of the bar and label is unchanged because progress-bar
redraw is an idle task.
Existing test_user_sees_progress_window_handle_widget_update_errors is
updated to mock update_idletasks. Added
test_progress_updates_do_not_pump_user_events as a regression guard so
a future change cannot silently restore update().
Signed-off-by: Yash Goel <yashvardhan664@gmail.com>1 parent cd88057 commit f1ad680
3 files changed
Lines changed: 40 additions & 6 deletions
File tree
- ardupilot_methodic_configurator
- tests
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
156 | | - | |
157 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
| |||
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| |||
133 | 137 | | |
134 | 138 | | |
135 | 139 | | |
136 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
137 | 145 | | |
138 | 146 | | |
139 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
251 | | - | |
| 250 | + | |
| 251 | + | |
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
261 | 283 | | |
262 | 284 | | |
263 | 285 | | |
| |||
0 commit comments