qt5-qtdeclarative/Avoid-calling-potentially-pure-virtual-method.patch

65 lines
2.7 KiB
Diff

From 0d31aa1617c96ed3e3624d77332ea6f13aba1492 Mon Sep 17 00:00:00 2001
From: David Edmundson <davidedmundson@kde.org>
Date: Thu, 23 Apr 2015 15:01:24 +0200
Subject: [PATCH 67/68] Avoid calling potentially pure virtual method
In Qt 5.4 screenChanged is called indirectly from the destructor of
QPlatformScreen. By comparing new values against the oldScreen we call
call virtual methods of QPlatformScreen from it's own destructor which
results in a crash.
This patch simply emits change signals whenever a screen change regardless
of whether the value differs from the previous screen. Arguably less
efficient, but better than crashing.
This fix is not needed in Qt 5.5 where the QPA architecture has changed.
Task-number: QTBUG-45753
Change-Id: Ic155906928855a377add9b21bff9e72b31f4667e
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
---
src/quick/items/qquickscreen.cpp | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index c4d1407..0900adb 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -347,24 +347,15 @@ void QQuickScreenAttached::screenChanged(QScreen *screen)
emit orientationUpdateMaskChanged();
}
- if (!oldScreen || screen->size() != oldScreen->size()) {
- emit widthChanged();
- emit heightChanged();
- }
- if (!oldScreen || screen->name() != oldScreen->name())
- emit nameChanged();
- if (!oldScreen || screen->orientation() != oldScreen->orientation())
- emit orientationChanged();
- if (!oldScreen || screen->primaryOrientation() != oldScreen->primaryOrientation())
- emit primaryOrientationChanged();
- if (!oldScreen || screen->availableVirtualGeometry() != oldScreen->availableVirtualGeometry())
- emit desktopGeometryChanged();
- if (!oldScreen || screen->logicalDotsPerInch() != oldScreen->logicalDotsPerInch())
- emit logicalPixelDensityChanged();
- if (!oldScreen || screen->physicalDotsPerInch() != oldScreen->physicalDotsPerInch())
- emit pixelDensityChanged();
- if (!oldScreen || screen->devicePixelRatio() != oldScreen->devicePixelRatio())
- emit devicePixelRatioChanged();
+ emit widthChanged();
+ emit heightChanged();
+ emit nameChanged();
+ emit orientationChanged();
+ emit primaryOrientationChanged();
+ emit desktopGeometryChanged();
+ emit logicalPixelDensityChanged();
+ emit pixelDensityChanged();
+ emit devicePixelRatioChanged();
connect(screen, SIGNAL(geometryChanged(QRect)),
this, SIGNAL(widthChanged()));
--
2.3.7