QPI/Cocoa: QNSView - guard removeFromSuperview by autorelease pool

removeFromSuperview could be called from outside the Qt domain (e.g from
a native cocoa gui). we need to guard it by an autorelease pool to make
sure that potential release/dealloc methods are not postponed to a point
when we do not have a qapplication anymore

Change-Id: If65cce4c524a16ffee125694c534f900c7d08fa8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Tim Blechmann 2015-11-18 17:11:07 +07:00 committed by Tor Arne Vestbø
parent 07efdb78f0
commit 084df84bd0
2 changed files with 7 additions and 0 deletions

View File

@ -99,6 +99,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
- (void)textInputContextKeyboardSelectionDidChangeNotification : (NSNotification *) textInputContextKeyboardSelectionDidChangeNotification;
- (void)viewDidHide;
- (void)viewDidUnhide;
- (void)removeFromSuperview;
- (BOOL)isFlipped;
- (BOOL)acceptsFirstResponder;

View File

@ -498,6 +498,12 @@ QT_WARNING_POP
m_platformWindow->exposeWindow();
}
- (void)removeFromSuperview
{
QMacAutoReleasePool pool;
[super removeFromSuperview];
}
- (void) flushBackingStore:(QCocoaBackingStore *)backingStore region:(const QRegion &)region offset:(QPoint)offset
{
m_backingStore = backingStore;