View Single Post
Old 04-13-2021, 07:02 PM   #526
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,465
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by capink View Post
After testing some more, I think I found the culprit. The chain loop makes this call between actions:

Code:
QApplication.processEvents()
If I comment this out, the problem does not happen anymore. I don't know calling processEvents() leads to this?
You are diving deep into Qt event management.

The "normal" reason for calling that method is that you are doing something on the GUI thread that takes a *long* time, or that your code is on a separate thread without normal event management. Making the call forces processing of queued GUI events, but it is doing so in the middle of processing some other event.

My experience is that it is rare that such a call is needed, and if it is needed then it is often a programming error where long-running "jobs" are running on the GUI thread. One must ask:
  • Is the processing really so long?
  • If it is so long, should we fork a subprocesses or is the "fork a subprocess" cure worse than the disease?
  • If it is so long, is there some way to chain the processing based on events, for example progress timers?
chaley is offline   Reply With Quote