https://bugs.kde.org/show_bug.cgi?id=460621
Bug ID: 460621 Summary: kcalc: high energy use due to KCalculator::resizeEvent() storm Classification: Applications Product: kcalc Version: 22.08.2 Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: ete...@alum.rit.edu Reporter: janne-...@jannau.net Target Milestone: --- Created attachment 152962 --> https://bugs.kde.org/attachment.cgi?id=152962&action=edit debug patch removing the resize call in resizeEvent SUMMARY Kcalc causes high energy use on Apple Silicon devices (M1 / M2) running Linux (https://asahilinux.org/). An idle Macbook with kcalc running uses ~9 Watt, the same system uses 3-4 Watt before starting kcalc and after closing it. This seems to be caused an endless storm of KCalculator::resizeEvent()s and resulting redraws. There appears to be a problem with resizing to the minimal size. This is possibly caused by calling QWidget::resize() from within KCalculator::resizeEvent(). The Qt documentation warns explicitly about calling ::resize() inside of ::resizeEvent(): https://doc.qt.io/qt-5/qwidget.html#size-prop . I'm not sure if this is the endless recursion warned about in the documentation. If so the event handling prevents unlimited memory use one would expect from an endless recursion. Commenting "KCalculator::resize(minSize);" in KCalculator::resizeEvent() prevents issue but results in window 1 pixel narrower than the minimal size. STEPS TO REPRODUCE 1. start kcalc OBSERVED RESULT kcalc uses between 65% (kcalc window is on-screen) and 80% (kcalc window is behind) of a single CPU core EXPECTED RESULT kcalc uses almost no CPU when idle SOFTWARE/OS VERSIONS Linux/KDE Plasma: AsahiLinux (Qt/KDE packages are identical to ArchLinux ARM) (available in About System) KDE Plasma Version: 5.25.5, 5.26.0 KDE Frameworks Version: 5.98.0, 5.99.0 Qt Version: 5.15.6 ADDITIONAL INFORMATION System is running Plasma (X11) with modeset driver, simpledrm and llvmpipe Running kcalc with the attached kcalc_resize_debug.diff results in following output: | resizeEvent: actual: 490x396 min: 490x396 old: 4294967295x4294967295 | resizeEvent: actual: 489x396 min: 490x396 old: 490x396 -- You are receiving this mail because: You are watching all bug changes.