Commit 1837008
committed
fix(startup): lazy-start search/imagehost worker threads to avoid pre-QApplication QEventLoop warning
SearchService and ImageHostService started their worker QThread in their constructors, which run before the QApplication is created in main(). The default QThread::run() calls exec(), constructing a QEventLoop while QCoreApplication::instance() is still null, emitting "QEventLoop: Cannot be used without QCoreApplication".
Defer moveToThread + start() to a lazy ensureWorkerThreadStarted() invoked on first async use (always after the app is running). Parent the worker to the service so a session that never searches/uploads still reclaims it via QObject child deletion; unparent before moveToThread on first start so the existing finished->deleteLater cleanup owns it thereafter.1 parent b9ff3d8 commit 1837008
4 files changed
Lines changed: 70 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| |||
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
48 | 69 | | |
49 | 70 | | |
50 | 71 | | |
| |||
263 | 284 | | |
264 | 285 | | |
265 | 286 | | |
| 287 | + | |
266 | 288 | | |
267 | 289 | | |
268 | 290 | | |
| |||
292 | 314 | | |
293 | 315 | | |
294 | 316 | | |
| 317 | + | |
295 | 318 | | |
296 | 319 | | |
297 | 320 | | |
| |||
304 | 327 | | |
305 | 328 | | |
306 | 329 | | |
| 330 | + | |
307 | 331 | | |
308 | 332 | | |
309 | 333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
122 | 130 | | |
123 | 131 | | |
124 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
291 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
292 | 297 | | |
293 | 298 | | |
294 | 299 | | |
| |||
317 | 322 | | |
318 | 323 | | |
319 | 324 | | |
320 | | - | |
321 | | - | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
322 | 331 | | |
323 | 332 | | |
324 | 333 | | |
| |||
353 | 362 | | |
354 | 363 | | |
355 | 364 | | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
356 | 377 | | |
357 | 378 | | |
358 | 379 | | |
| |||
363 | 384 | | |
364 | 385 | | |
365 | 386 | | |
| 387 | + | |
366 | 388 | | |
367 | 389 | | |
368 | 390 | | |
| |||
386 | 408 | | |
387 | 409 | | |
388 | 410 | | |
| 411 | + | |
389 | 412 | | |
390 | 413 | | |
391 | 414 | | |
| |||
409 | 432 | | |
410 | 433 | | |
411 | 434 | | |
| 435 | + | |
412 | 436 | | |
413 | 437 | | |
414 | 438 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
68 | 76 | | |
69 | 77 | | |
70 | 78 | | |
| |||
0 commit comments