summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2010-07-09 08:47:46 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2010-07-09 08:50:00 (GMT)
commit1e9a92cd6e8670a9dc90fed2044e7de38a3b13e6 (patch)
tree53334cc704c2e67bc55c876d6d64d457578b089b
parente02d97c50cee8bdc662bb1183ed01aa0dac53f01 (diff)
downloadQt-1e9a92cd6e8670a9dc90fed2044e7de38a3b13e6.zip
Qt-1e9a92cd6e8670a9dc90fed2044e7de38a3b13e6.tar.gz
Qt-1e9a92cd6e8670a9dc90fed2044e7de38a3b13e6.tar.bz2
Incorrect assertion in item views
we were checking if the parent of main items was QModelIndex instead if checking if it is just invalid (it might have a pointer to its model and still be invalid). Task-number: QTBUG-12090 Reviewed-by: Ian Walters
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp2
-rw-r--r--src/gui/kernel/qapplication.cpp2
-rw-r--r--src/gui/kernel/qwidget.cpp4
3 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 15e59ba..302aa20 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -653,7 +653,7 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
"QAbstractItemView::setModel",
"A model should return the exact same index "
"(including its internal id/pointer) when asked for it twice in a row.");
- Q_ASSERT_X(d->model->index(0,0).parent() == QModelIndex(),
+ Q_ASSERT_X(!d->model->index(0,0).parent().isValid(),
"QAbstractItemView::setModel",
"The parent of a top level index should be invalid");
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 4f557d6..6a67369 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -5780,6 +5780,8 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window,
QGestureManager* QGestureManager::instance()
{
QApplicationPrivate *qAppPriv = QApplicationPrivate::instance();
+ if (!qAppPriv)
+ return 0;
if (!qAppPriv->gestureManager)
qAppPriv->gestureManager = new QGestureManager(qApp);
return qAppPriv->gestureManager;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 2627960..2e980c1 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -12053,8 +12053,8 @@ void QWidget::ungrabGesture(Qt::GestureType gesture)
{
Q_D(QWidget);
if (d->gestureContext.remove(gesture)) {
- QGestureManager *manager = QGestureManager::instance();
- manager->cleanupCachedGestures(this, gesture);
+ if (QGestureManager *manager = QGestureManager::instance())
+ manager->cleanupCachedGestures(this, gesture);
}
}
#endif // QT_NO_GESTURES