Return 1.0 for devicePixelRatio in QCocoaWindow if no valid window
If m_window is invalid, devicePixelRatio returns 0, which leads to adverse effects in other parts of the code. For example, qquickshadereffectsource.cpp will get stuck in an infinite loop trying to multiply 0 by 2. Task-number: QTBUG-32975 Change-Id: Ie3db86f1f459df018ebce67bcb4226f6cffe854e Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
parent
9194fc00a6
commit
79570157e3
@ -1007,7 +1007,12 @@ qreal QCocoaWindow::devicePixelRatio() const
|
||||
{
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
|
||||
return qreal([[m_contentView window] backingScaleFactor]);
|
||||
NSWindow* window = [m_contentView window];
|
||||
if (window) {
|
||||
return qreal([window backingScaleFactor]);
|
||||
} else {
|
||||
return 1.0;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user