diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-06-23 13:32:25 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-06-26 16:32:18 +0000 |
commit | 3851a8ff20c6aed0807bfdc4588ae108a2b108ec (patch) | |
tree | eb91d100fc74eb0637dca17a6406989c84bd67e5 /src/plugins | |
parent | 460a591a9323c47189ad95111cbd27a1e7fc534f (diff) |
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>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 66c3b6fad4..80c8bfc48b 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -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())]; } |