summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qdnd.cpp3
-rw-r--r--src/gui/kernel/qguiapplication.cpp11
-rw-r--r--src/gui/kernel/qplatformdrag.cpp12
-rw-r--r--src/gui/kernel/qplatformdrag.h2
-rw-r--r--src/gui/kernel/qscreen_p.h3
5 files changed, 27 insertions, 4 deletions
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index f515fe18df..2a6cc4fc99 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -134,7 +134,8 @@ Qt::DropAction QDragManager::drag(QDrag *o)
QGuiApplicationPrivate::instance()->notifyDragStarted(o);
const Qt::DropAction result = m_platformDrag->drag(m_object);
m_object = 0;
- o->deleteLater();
+ if (!m_platformDrag->ownsDragObject())
+ o->deleteLater();
return result;
}
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 92be903b41..326d9a7b52 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2572,9 +2572,14 @@ void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePriva
return;
QScreen *s = e->screen.data();
- s->d_func()->refreshRate = e->rate;
-
- emit s->refreshRateChanged(s->refreshRate());
+ qreal rate = e->rate;
+ // safeguard ourselves against buggy platform behavior...
+ if (rate < 1.0)
+ rate = 60.0;
+ if (!qFuzzyCompare(s->d_func()->refreshRate, rate)) {
+ s->d_func()->refreshRate = rate;
+ emit s->refreshRateChanged(s->refreshRate());
+ }
}
void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e)
diff --git a/src/gui/kernel/qplatformdrag.cpp b/src/gui/kernel/qplatformdrag.cpp
index 8a5c7264d1..326f092ead 100644
--- a/src/gui/kernel/qplatformdrag.cpp
+++ b/src/gui/kernel/qplatformdrag.cpp
@@ -241,6 +241,18 @@ QPixmap QPlatformDrag::defaultPixmap()
return *qt_drag_default_pixmap();
}
+/*!
+ \since 5.4
+ \brief Returns bool indicating whether QPlatformDrag takes ownership
+ and therefore responsibility of deleting the QDrag object passed in
+ from QPlatformDrag::drag. This can be useful on platforms where QDrag
+ object has to be kept around.
+ */
+bool QPlatformDrag::ownsDragObject() const
+{
+ return false;
+}
+
#endif // QT_NO_DRAGANDDROP
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformdrag.h b/src/gui/kernel/qplatformdrag.h
index 34ad11e45f..ce7a9aa1f2 100644
--- a/src/gui/kernel/qplatformdrag.h
+++ b/src/gui/kernel/qplatformdrag.h
@@ -98,6 +98,8 @@ public:
static QPixmap defaultPixmap();
+ virtual bool ownsDragObject() const;
+
private:
QPlatformDragPrivate *d_ptr;
diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h
index cdb923c429..53d4f3404a 100644
--- a/src/gui/kernel/qscreen_p.h
+++ b/src/gui/kernel/qscreen_p.h
@@ -64,6 +64,9 @@ public:
availableGeometry = platformScreen->availableGeometry();
logicalDpi = platformScreen->logicalDpi();
refreshRate = platformScreen->refreshRate();
+ // safeguard ourselves against buggy platform behavior...
+ if (refreshRate < 1.0)
+ refreshRate = 60.0;
updatePrimaryOrientation();