macOS: Work around buildup of NSDisplayCycle objects during rapid painting
Task-number: QTBUG-60012 Change-Id: Id5291f768a4b9d8d9c77804cb697e0c9fb151012 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>bb10
parent
460a591a93
commit
3851a8ff20
|
|
@ -381,6 +381,14 @@ static bool _q_dontOverrideCtrlLMB = false;
|
|||
|
||||
m_backingStore = backingStore;
|
||||
m_backingStoreOffset = offset * m_backingStore->paintDevice()->devicePixelRatio();
|
||||
|
||||
// Prevent buildup of NSDisplayCycle objects during setNeedsDisplayInRect, which
|
||||
// would normally be released as part of the root runloop's autorelease pool, but
|
||||
// can be kept alive during repeated painting which starve the root runloop.
|
||||
// FIXME: Move this to the event dispatcher, to cover more cases of starvation.
|
||||
// FIXME: Figure out if there's a way to detect and/or prevent runloop starvation.
|
||||
QMacAutoReleasePool pool;
|
||||
|
||||
for (const QRect &rect : region)
|
||||
[self setNeedsDisplayInRect:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue