[Interest] QSqlDatabase segfault - me or Qt5?
Scott Aron Bloom
scott.bloom at onshorecs.com
Mon Mar 4 10:59:50 CET 2013
Quick question, any chance any of this is multi-threaded?
-----Original Message-----
From: interest-bounces+scott.bloom=onshorecs.com at qt-project.org [mailto:interest-bounces+scott.bloom=onshorecs.com at qt-project.org] On Behalf Of bill.king at nokia.com
Sent: Monday, March 04, 2013 1:50 AM
To: list at qtrac.plus.com; interest at qt-project.org
Subject: Re: [Interest] QSqlDatabase segfault - me or Qt5?
Not enough info in the backtrace. Hrm. I did see this many years ago, but I can't remember what caused it. Some form of being a bit too smart for my own good I suspect ;)
Exact line in the destructor could help. Are you deriving from the QSqlDatabase class? Or maybe holding a pointer to a deleted copy? Maybe a valgrind --tool=memcheck run may shed some light.
--
Bill King
Test Engineer
Nokia, Guidance Team
> -----Original Message-----
> From: interest-bounces+bill.king=nokia.com at qt-project.org
> [mailto:interest-bounces+bill.king=nokia.com at qt-project.org] On Behalf
> Of ext Mark Summerfield
> Sent: Friday, 1 March 2013 3:24 PM
> To: interest at qt-project.org
> Subject: [Interest] QSqlDatabase segfault - me or Qt5?
> Importance: High
>
> Hi,
>
> I've got a release version of Qt that's giving this on 64-bit linux:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff7bb35ea in QSqlDatabase::close() () from
> /home/mark/opt/qt501/lib/libQt5Sql.so.5 (gdb) bt
> #0 0x00007ffff7bb35ea in QSqlDatabase::close() () from
> /home/mark/opt/qt501/lib/libQt5Sql.so.5 #1 0x00007ffff7bb475d in
> QSqlDatabase::~QSqlDatabase() ()
> from /home/mark/opt/qt501/lib/libQt5Sql.so.5 #2 0x00007ffff7bb723d in ??
> () from /home/mark/opt/qt501/lib/libQt5Sql.so.5 #3 0x00007ffff73faa2d
> in QHashData::free_helper(void (*)(QHashData::Node*)) () from
> /home/mark/opt/qt501/lib/libQt5Core.so.5 #4 0x00007ffff7bb6e1c in ??
> () from /home/mark/opt/qt501/lib/libQt5Sql.so.5 #5 0x00007ffff664c612
> in ?? () from /lib/libc.so.6 #6 0x00007ffff664c665 in exit () from
> /lib/libc.so.6 #7
> 0x00007ffff6634c94 in __libc_start_main () from /lib/libc.so.6 #8
> 0x0000000000404569 in _start ()
>
> There's no mention of my own code.
>
> I have a Database class which creates database connections using
> QSqlDatabase::addDatabase(). I create a fresh m_cname (connection
> name) for each addDatabase() and store it for use in the methods and
> in the
> destructor:
>
> void Database::~Database()
> {
> if (QSqlDatabase::contains(m_cname)) {
> {
> QSqlDatabase db = QSqlDatabase::database(m_cname);
> db.close();
> }
> QSqlDatabase::removeDatabase(m_cname);
> }
> }
>
> Any suggestions as to what I'm doing wrong?
>
> Thanks!
>
> --
> Mark Summerfield, Qtrac Ltd, www.qtrac.eu
> C++, Python, Qt, PyQt - training and consultancy
> "Programming in Go" - ISBN 0321774639
> http://www.qtrac.eu/gobook.html
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list