Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.9.0 Beta 1
-
None
-
macOS 10.11
-
-
b1131074199aae97b2a005cba871f6baf2a32c63
Description
macOS instruments records quite a lot of leaks with a backtrace like this:
0 libsystem_malloc.dylib malloc_zone_calloc 1 libsystem_malloc.dylib calloc 2 libobjc.A.dylib class_createInstance 3 libobjc.A.dylib +[NSObject allocWithZone:] 4 libobjc.A.dylib +[NSObject new] 5 AppKit -[NSControl _commonEarlyInit] 6 AppKit -[NSControl initWithFrame:] 7 AppKit -[NSScroller initWithFrame:] 8 QtWidgets QMacStyle::drawComplexControl(QStyle::ComplexControl, QStyleOptionComplex const*, QPainter*, QWidget const*) const 9 QtWidgets QScrollBar::paintEvent(QPaintEvent*) 10 QtWidgets QWidget::event(QEvent*) 11 QtWidgets QScrollBar::event(QEvent*) 12 QtWidgets QApplicationPrivate::notify_helper(QObject*, QEvent*) 13 QtWidgets QApplication::notify(QObject*, QEvent*) 14 QtCore QCoreApplication::notifyInternal2(QObject*, QEvent*) 15 QtWidgets QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 16 QtWidgets QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 17 QtWidgets QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 18 QtWidgets QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 19 QtWidgets QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 20 QtWidgets QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 21 QtWidgets QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 22 QtWidgets QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 23 QtWidgets QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) 24 QtWidgets QWidgetBackingStore::doSync() 25 QtWidgets QWidget::event(QEvent*) 26 QtWidgets QApplicationPrivate::notify_helper(QObject*, QEvent*) 27 QtWidgets QApplication::notify(QObject*, QEvent*) 28 QtCore QCoreApplication::notifyInternal2(QObject*, QEvent*) 29 QtCore QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) 30 libqcocoa.dylib QCocoaEventDispatcherPrivate::processPostedEvents() 31 libqcocoa.dylib QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void*) 32 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 33 CoreFoundation __CFRunLoopDoSources0 34 CoreFoundation __CFRunLoopRun
I'm not sure if this code is qmacstyle_mac.mm is actually correct:
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:(CGContextRef)cg flipped:NO]]; NSScroller *scroller = reinterpret_cast<NSScroller*>(d->nsscroller); [scroller initWithFrame:NSMakeRect(0, 0, slider->rect.width(), slider->rect.height())];
if d->nsscroller is some kind of cache, shouldn't it be released before calling initWithFrame? Does that caching make any sense at all?
Attachments
For Gerrit Dashboard: QTBUG-60004 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
191271,5 | QMacStyle: Fix scroller memory leak | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |