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

QSqlDatabase::close may lead to crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • None
    • 5.2.0, 5.3.0 Beta1
    • SQL Support
    • None
    • Debian Wheezy and Mageia 4 Linux
    • 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. sample.tgz
          1 kB
        2. broom.zip
          155 kB
        3. kactivitymanagerd-gdb.txt
          14 kB
        For Gerrit Dashboard: QTBUG-35977
        # Subject Branch Project Status CR V

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes