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

QSqlDatabase::close may lead to crash

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4: Low
    • Resolution: Done
    • Affects Version/s: 5.2.0, 5.3.0 Beta1
    • Fix Version/s: None
    • Component/s: SQL Support
    • Labels:
      None
    • Environment:
      Debian Wheezy and Mageia 4 Linux
    • Commits:
      452ad2bb1358ad5206440457fecbac92779dc680

      Description

      Hi all

      I have a very weird problem with crash after calling QSqlDatabase::close().
      This is what I found:

      I've a QSqlDatabase object hold in an object. This object is hold in std::unique_ptr. I use this QSqlDatabase to talk with MySQL server.

      When the application is being closed, and my object with QSqlDatabase object is being destroyed - a close() in QSqlDatabase is being called. This causes a crash.

      The problem is that inside of QSqlDatabase::close() a close() on driver is being called, but plugin with mysql driver was already unloaded! So implementation of driver refers to invalid memory.

      Gdb shows, that mysql plugin is being unloaded on application close, while some of the objects refering to it were not destroyed yet.

      I've tried to reproduce it on a smaller example without succeed.

      I could reproduce the problem on two machines (Mageia 4 Linux and Debian Wheezy).

        Attachments

        1. broom.zip
          155 kB
        2. kactivitymanagerd-gdb.txt
          14 kB
        3. sample.tgz
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            andysh Andy Shaw
            Reporter:
            kicer Michał Walenciak
            Votes:
            17 Vote for this issue
            Watchers:
            19 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes