Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-13423

Introduction of numericalPrecisionPolicy make database() function non thread safe anymore

    XMLWordPrintable

Details

    • 68241a1d889b94156a63159fb7cdcffc10b9d397

    Description

      I was not able to create a test case to reproduce the issue but I have included a stack trace of an application that encounters the problem with Qt 4.6.3.

      It looks like the problem arises if, for some reason, the driver is a QSqlNullDriver. Here is the suggested patch that seems fixing the problem.

      diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
      index 022bc47..b3dad08 100644
      --- a/src/sql/kernel/qsqldatabase.cpp
      +++ b/src/sql/kernel/qsqldatabase.cpp
      @@ -135,7 +135,7 @@ public:
               port(-1)
           {
               ref = 1;
      -        if(driver)
      +        if(driver && (driver != shared_null()->driver))
                   precisionPolicy = driver->numericalPrecisionPolicy();
               else
                   precisionPolicy= QSql::LowPrecisionDouble;
      @@ -1514,7 +1514,7 @@ void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy pr
       
           Returns the current default precision policy for the database connection.
       
      -    \sa QSql::NumericalPrecisionPolicy, setNumericalPrecisionPolicy(), 
      +    \sa QSql::NumericalPrecisionPolicy, setNumericalPrecisionPolicy(),
           QSqlQuery::numericalPrecisionPolicy(), QSqlQuery::setNumericalPrecisionPolicy()
       */
       QSql::NumericalPrecisionPolicy QSqlDatabase::numericalPrecisionPolicy() const
      
      

      Attachments

        For Gerrit Dashboard: QTBUG-13423
        # Subject Branch Project Status CR V

        Activity

          People

            andysh Andy Shaw
            sanonymous Nokia Qt Support (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes