Bug 450394 - BambooTracker slows down on Breeze, due to leaking QProxyStyle and Breeze installing global event handlers
Summary: BambooTracker slows down on Breeze, due to leaking QProxyStyle and Breeze ins...
Status: CONFIRMED
Alias: None
Product: Breeze
Classification: Plasma
Component: QStyle (other bugs)
Version First Reported In: 5.24.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-16 16:57 UTC by nyanpasu64
Modified: 2022-02-24 17:40 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nyanpasu64 2022-02-16 16:57:53 UTC
SUMMARY
When I run BambooTracker and open and close many different instrument dialogs, the application slows down when rendering with Breeze theme.

STEPS TO REPRODUCE
1. Install/build and run https://github.com/BambooTracker/BambooTracker (self-built or from a distro package).
2. Download and extract https://github.com/BambooTracker/BambooTracker/files/7169359/32.64.128.instruments.zip, and open "128 instruments.btm" in BambooTracker.
3. In the instruments pane in the top of the window, double-click each instrument and then close the dialog (eg. pressing Esc).

The application leaks QProxyStyle (yes, it should be fixed, I reported at https://github.com/BambooTracker/BambooTracker/issues/418). Each FM instrument dialog creates dozens of `LabeledVerticalSlider`, each with their own `SliderStyle : QProxyStyle` instance intended to set `styleHint(QStyle::SH_Slider_AbsoluteSetButtons) = Qt::LeftButton`. When you open dozens of instrument dialogs, the app becomes increasingly unresponsive as `QCoreApplication` loops through around a thousand event filters per event. (Due to another bug, opening and closing an instrument dialog doesn't delete the dialog object, so you only need to open and close one dialog at a time to get the slowdown.)

I haven't fixed the bugs in BambooTracker itself, and neither have the app's maintainers. I suspect a lazy-init `static SliderStyle * = nullptr` might work better than the ideas I listed in the original bug report.

OBSERVED RESULT
The application should start slowing down after around 10 instruments. By the time you've opened 30-40 instrument dialogs, there will be a noticeable delay (0.5-1 second) opening/closing instrument or other dialogs. The slowdown increases as you open more instruments.

EXPECTED RESULT
Each QProxyStyle created doesn't cause a global slowdown. I don't notice any slowdown when setting KDE to use the Fusion application style instead of Breeze.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.24.1
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2
Kernel Version: 5.16.9-zen1-1-zen (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GT 730/PCIe/SSE2

ADDITIONAL INFORMATION
Initially reported as 442465, which was closed with the message "If you have an example of actual apps in the wild using proxy styles and having lag due to Breeze, please open a new bug about this."