Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Crash after moving from Qt 5.9 to Qt 5.12
Forum Updated to NodeBB v4.3 + New Features

Crash after moving from Qt 5.9 to Qt 5.12

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 372 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FaCal
    wrote on last edited by
    #1

    Hi everybody!

    I'm working on a porting from Qt 5.9.7 to Qt 5.12.5 . The application is connected to a db sqlite and it uses a QSqlDatabase class.
    When using Qt 5.12.5, I see a crash in QSqlQuery prepare or in the exec methods. I tried to print the queries and every time the application crash in a different one. The queries seems to be correct.
    In a deeper analysis, I saw that the same database connection is used in 2 threads at the same time (2 select queries) and I think this is the cause of the crash because the threads cannot share the connection (https://stackoverflow.com/questions/47457478/using-qsqlquery-from-multiple-threads).

    My answer is: why did this never happen in Qt 5.9.7? Could be connected to the porting?

    Best regards!
    Fabio

    JonBJ 1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @FaCal said in Crash after moving from Qt 5.9 to Qt 5.12:

      why did this never happen in Qt 5.9.7?

      Because in 5.9 the thread check was not there and you got rare race conditions now and then.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      3
      • F FaCal

        Hi everybody!

        I'm working on a porting from Qt 5.9.7 to Qt 5.12.5 . The application is connected to a db sqlite and it uses a QSqlDatabase class.
        When using Qt 5.12.5, I see a crash in QSqlQuery prepare or in the exec methods. I tried to print the queries and every time the application crash in a different one. The queries seems to be correct.
        In a deeper analysis, I saw that the same database connection is used in 2 threads at the same time (2 select queries) and I think this is the cause of the crash because the threads cannot share the connection (https://stackoverflow.com/questions/47457478/using-qsqlquery-from-multiple-threads).

        My answer is: why did this never happen in Qt 5.9.7? Could be connected to the porting?

        Best regards!
        Fabio

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @FaCal
        As per the docs, you are indeed correct that you must not attempt to use a connection from different threads.

        I don't imagine anyone will know specifically why you got away with it in one version of Qt but not in another. That's what threading issues can be like.

        1 Reply Last reply
        1
        • F Offline
          F Offline
          FaCal
          wrote on last edited by
          #4

          Thank you a lot!

          BR
          Fabio

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved