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

MySql connection fails if first activity is not on main thread

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P4: Low P4: Low
    • None
    • 5.7.0
    • SQL Support
    • None

      This is related to the existing bug QTBUG-31468:

      Per http://dev.mysql.com/doc/refman/5.7/en/mysql-library-init.html

      You must either call mysql_library_init() prior to spawning any threads, or else use a mutex to protect the call, whether you invoke mysql_library_init() or indirectly through mysql_init(). Do this prior to any other client library call.

      So in addition to not being thread-safe per QTBUG-31468, if an application calls addDatabase() for the first time on a thread, the init() can fail in a quite inscrutable way - see http://stackoverflow.com/q/38343945/1296734

      Until the plugin can be fixed, can the docs be updated to warn about this gotcha?

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            andysh Andy Shaw
            eclarkso Edward Clarkson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes