Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QWidget::setStyle(new QStyle subclass) leaks memory #418

Closed
nyanpasu64 opened this issue Sep 14, 2021 · 0 comments · Fixed by #440
Closed

QWidget::setStyle(new QStyle subclass) leaks memory #418

nyanpasu64 opened this issue Sep 14, 2021 · 0 comments · Fixed by #440
Labels
bug Something isn't working

Comments

@nyanpasu64
Copy link
Contributor

Checklist

  • I am reporting exactly 1 bug with this issue.
  • This bug hasn't already been reported.
  • This bug hasn't already been fixed in the latest development build.

Bug Description

All calls to setStyle(new SliderStyle) or setStyle(new SliderStyle()) leak memory.

void QWidget::setStyle(QStyle *style) says:

Sets the widget's GUI style to style. The ownership of the style object is not transferred.

One workaround is using a single central SliderStyle object. In general, global state is a code smell, but this works around an issue where on KDE Breeze, every QProxyStyle instance created installs two event filters on QCoreApplication which intercept all events sent to all widgets in the app. As a result, when you open dozens of instrument dialogs, each of which creates dozens of LabeledVerticalSlider and SliderStyle, 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 don't even need dozens of instrument dialogs open at once.)

Another workaround is adding a SliderStyle field to each class using it. This doesn't fix the slowdown, but ensures the event filters are uninstalled when the widgets are deleted.

System Information

  • Operating System: Arch Linux
  • BambooTracker Version: unstable-06e20993
  • Build Type: AUR bambootracker-git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant