Commit a1bc76c
tests: flush DeferredDelete and run gc in qt_test teardown
A qt_test body runs inside app.exec() (one loop level deep, via doInvoke),
so a QObject.deleteLater() posted there is never delivered by processEvents()
-- Qt only delivers DeferredDelete once the loop unwinds to the level at which
it was posted. The C++ objects, and everything they reference (e.g. a
QEWallet's self.wallet), lingered until some later, racy spin of the loop.
Flush them synchronously via sendPostedEvents(None, DeferredDelete), then
gc.collect() so reference cycles (e.g. wallet<->txbatcher) are reclaimed and
their EventListener.__del__ unregisters callbacks. This keeps QML tests from
leaking wallet objects and callbacks into later tests (e.g. test_daemon's GC
sanity checks).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 4c6b437 commit a1bc76c
1 file changed
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
199 | 221 | | |
200 | 222 | | |
0 commit comments