Commit 776d48d
committed
Merge bitcoin-core/gui#801: Fix nullptr clientModel access during shutdown
b7aa717 refactor: gui, simplify boost signals disconnection (furszy)
f3a612f gui: guard accessing a nullptr 'clientModel' (furszy)
Pull request description:
Fixing bitcoin#800.
During shutdown, already queue events dispatched from the backend such
'numConnectionsChanged' and 0networkActiveChanged' could try to access
the clientModel object, which might not exist because we manually delete
it inside 'BitcoinApplication::requestShutdown()'.
This happen because boost does not clears the queued events when they arise
concurrently with the signal disconnection (see https://www.boost.org/doc/libs/1_55_0/doc/html/signals2/thread-safety.html).
From the docs:
1) "Note that since we unlock the connection's mutex before executing its associated slot, it is possible a slot will still be executing after it has been disconnected by a [connection::disconnect](https://www.boost.org/doc/libs/1_55_0/doc/html/boost/signals2/connection.html#idp89761576-bb)(), if the disconnect was called concurrently with signal invocation."
2) "The fact that concurrent signal invocations use the same combiner object means you need to insure any custom combiner you write is thread-safe"
So, we need to guard `clientModel` before accessing it at the handler side.
ACKs for top commit:
hebasto:
re-ACK b7aa717
Tree-SHA512: f1a21d69248628f6a13556a9438c9e4ea9f0a3678aab09ddfe836e78e4eee405a6730d37d39f1445068ada3a110b655b619cf0e090fc2d0cdf99bed061364aebFile tree
5 files changed
+31
-29
lines changed- src/qt
5 files changed
+31
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
375 | 380 | | |
376 | 381 | | |
377 | 382 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
989 | 989 | | |
990 | 990 | | |
991 | 991 | | |
| 992 | + | |
992 | 993 | | |
993 | 994 | | |
994 | 995 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
81 | 86 | | |
82 | 87 | | |
83 | 88 | | |
| |||
238 | 243 | | |
239 | 244 | | |
240 | 245 | | |
241 | | - | |
| 246 | + | |
242 | 247 | | |
243 | 248 | | |
244 | | - | |
245 | | - | |
| 249 | + | |
| 250 | + | |
246 | 251 | | |
247 | 252 | | |
248 | | - | |
249 | | - | |
| 253 | + | |
| 254 | + | |
250 | 255 | | |
251 | 256 | | |
252 | | - | |
253 | | - | |
| 257 | + | |
| 258 | + | |
254 | 259 | | |
255 | 260 | | |
256 | 261 | | |
257 | | - | |
258 | | - | |
| 262 | + | |
| 263 | + | |
259 | 264 | | |
260 | 265 | | |
261 | 266 | | |
262 | | - | |
263 | | - | |
| 267 | + | |
| 268 | + | |
264 | 269 | | |
265 | 270 | | |
266 | | - | |
267 | | - | |
| 271 | + | |
| 272 | + | |
268 | 273 | | |
269 | 274 | | |
270 | | - | |
| 275 | + | |
271 | 276 | | |
272 | 277 | | |
273 | 278 | | |
274 | 279 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
| 280 | + | |
282 | 281 | | |
283 | 282 | | |
284 | 283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 100 | + | |
105 | 101 | | |
106 | 102 | | |
107 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
966 | 966 | | |
967 | 967 | | |
968 | 968 | | |
| 969 | + | |
969 | 970 | | |
970 | 971 | | |
971 | 972 | | |
| |||
0 commit comments