[Development] [fix]: Assistant (and others) burning CPU because of #f27d1ccbb24ec2fd4098f2976503478831006cc8 ?

René J.V. Bertin rjvbertin at gmail.com
Tue Aug 29 10:10:53 CEST 2017


On Tuesday August 29 2017 02:02:59 Gabriel de Dietrich wrote:
>FYI: QCocoaMenu: Stop update timer (Merged)<https://codereview.qt-project.org/203791>

Thanks for the heads-up.

>
>On Aug 29, 2017, at 9:00 AM, Thiago Macieira <thiago.macieira at intel.com<mailto:thiago.macieira at intel.com>> wrote:
>
>On Monday, 28 August 2017 17:06:18 PDT René J.V. Bertin wrote:
>       killTimer(m_updateTimer);

>Yeah, if you don't kill the timer, it will keep firing.

Which we just rediscovered :) Funny though, apparently 1 misdirected startTimer() call can turn any application in a CPU hog that burns cycles without ever doing anything. Wouldn't it be safer for QObject::timerEvent() to kill any timer that triggers it, possibly even do an abort if it can do some kind of runtime debug mode detection? At least then it's set to a 0 (zero) interval?

It took me an unreasonable amount of time trying to figure out the reason for the burning, the fact that QCocoaMenu::timerEvent() could be being called as fast as possible and for nothing occurred to me only after trying all other possibilities. And I knew only the timer change could be the culprit; I can only imagine how much more time I'd have spent if this bug had been latent for a few months.

BTW, the 1st application in which I noticed this doesn't use the native menubar at all. I'm going to have to try and understand what business it has using QCocoaMenu...

R.



More information about the Development mailing list