diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test index 103321e451..65bc874617 100755 --- a/config.tests/unix/compile.test +++ b/config.tests/unix/compile.test @@ -67,7 +67,7 @@ test -r Makefile && $MAKE distclean >/dev/null 2>&1 # Make sure output from possible previous tests is gone rm -f "$EXE" "${EXE}.exe" -set -- "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG+=android_app" "CONFIG-=debug_and_release app_bundle lib_bundle" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" +set -- "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG+=android_app" "CONFIG-=debug_and_release app_bundle lib_bundle" "LIBS+=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile" if [ "$VERBOSE" = "yes" ]; then OUTDIR=$OUTDIR "$@" && $MAKE && SUCCESS=yes else diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp index 05c4371a58..60155c96fd 100644 --- a/src/corelib/thread/qfutureinterface.cpp +++ b/src/corelib/thread/qfutureinterface.cpp @@ -193,16 +193,19 @@ void QFutureInterfaceBase::waitForResume() int QFutureInterfaceBase::progressValue() const { + const QMutexLocker lock(&d->m_mutex); return d->m_progressValue; } int QFutureInterfaceBase::progressMinimum() const { + const QMutexLocker lock(&d->m_mutex); return d->m_progressMinimum; } int QFutureInterfaceBase::progressMaximum() const { + const QMutexLocker lock(&d->m_mutex); return d->m_progressMaximum; } diff --git a/src/corelib/thread/qfutureinterface_p.h b/src/corelib/thread/qfutureinterface_p.h index 2321ce8d72..e2d588cd07 100644 --- a/src/corelib/thread/qfutureinterface_p.h +++ b/src/corelib/thread/qfutureinterface_p.h @@ -146,18 +146,20 @@ public: QAtomicInt m_refCountT; }; + // T: accessed from executing thread + // Q: accessed from the waiting/querying thread RefCount refCount; mutable QMutex m_mutex; QWaitCondition waitCondition; QList outputConnections; - int m_progressValue; - int m_progressMinimum; - int m_progressMaximum; + int m_progressValue; // TQ + int m_progressMinimum; // TQ + int m_progressMaximum; // TQ QFutureInterfaceBase::State state; QElapsedTimer progressTime; QWaitCondition pausedWaitCondition; QtPrivate::ResultStoreBase m_results; - bool manualProgress; + bool manualProgress; // only accessed from executing thread int m_expectedResultCount; QtPrivate::ExceptionStore m_exceptionStore; QString m_progressText; diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp index 83cf0394f9..71a10c45d8 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp @@ -146,6 +146,7 @@ private slots: void mysql_multiselect(); // For task 144331 void mysql_savepointtest_data() { generic_data("QMYSQL"); } void mysql_savepointtest(); + void mysql_connectWithInvalidAddress(); void accessOdbc_strings_data() { generic_data(); } void accessOdbc_strings(); @@ -2192,6 +2193,14 @@ void tst_QSqlDatabase::mysql_savepointtest() QVERIFY_SQL(q, exec("savepoint foo")); } +void tst_QSqlDatabase::mysql_connectWithInvalidAddress() +{ + // Ensure that giving invalid connection parameters fails correctly + QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); + db.setHostName("invalid.local"); + QCOMPARE(db.open(), false); +} + void tst_QSqlDatabase::oci_tables() { QSKIP("Requires specific permissions to create a system table");