macOS: don’t crash when wrapping foreign views
window.contentView can be of any NSView subclass. Get to the QCocoaWindow via QCocoaNSWindow instead. Change-Id: I8c761fd22e6078b075d8dd035ad767b9e4cb6da2 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>bb10
parent
fc9baeeb9f
commit
24eb0b33a4
|
|
@ -51,7 +51,9 @@ static QRegExp whitespaceRegex = QRegExp(QStringLiteral("\\s*"));
|
|||
|
||||
static QCocoaWindow *toPlatformWindow(NSWindow *window)
|
||||
{
|
||||
return qnsview_cast(window.contentView).platformWindow;
|
||||
if ([window conformsToProtocol:@protocol(QNSWindowProtocol)])
|
||||
return static_cast<QCocoaNSWindow *>(window).platformWindow;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@implementation QNSWindowDelegate
|
||||
|
|
|
|||
Loading…
Reference in New Issue