Remove Q_ASSERT from modeltest
authorJason McDonald <jason.mcdonald@nokia.com>
Thu, 5 May 2011 04:04:16 +0000 (14:04 +1000)
committerRohan McGovern <rohan.mcgovern@nokia.com>
Wed, 18 May 2011 00:46:45 +0000 (10:46 +1000)
Report an informative fatal error if passed a null model, rather than
aborting in a debug build and giving a bunch of signal connection errors
in a release build.

Change-Id: Ia240e741b9d6ec03fd5ed3a14cf4fa44b55af911
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
(cherry picked from commit 841cc610df61a266ebcca2bfef2542a7d4fea68d)

tests/auto/modeltest/modeltest.cpp

index 98d707c..0329c3e 100644 (file)
@@ -55,7 +55,8 @@ Q_DECLARE_METATYPE ( QModelIndex )
 */
 ModelTest::ModelTest ( QAbstractItemModel *_model, QObject *parent ) : QObject ( parent ), model ( _model ), fetchingMore ( false )
 {
-    Q_ASSERT ( model );
+    if (!model)
+        qFatal("%s: model must not be null", Q_FUNC_INFO);
 
     connect ( model, SIGNAL ( columnsAboutToBeInserted ( const QModelIndex &, int, int ) ),
               this, SLOT ( runAllTests() ) );