Bug 339074 - CORE : warning from Qt when in database connection checker [patch]
Summary: CORE : warning from Qt when in database connection checker [patch]
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Engine (show other bugs)
Version: 4.3.0
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-14 13:57 UTC by Luca Carlon
Modified: 2014-09-15 20:42 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.4.0


Attachments
Patch do free QSqlDatabase object before connection is removed. (2.75 KB, patch)
2014-09-14 13:58 UTC, Luca Carlon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Carlon 2014-09-14 13:57:56 UTC
Don't actually know if this is an actual issue or not, maybe not even leak in it, but a warning from Qt arrives when digikam starts:

QSqlDatabasePrivate::removeDatabase: connection 'ConnectionTest' is still in use, all queries will cease to work.

and it seems the Qt docs say to destroy the QSqlDatabase object before removing the connection: http://qt-project.org/doc/qt-4.7/qsqldatabase.html in removeConnection(). Actually not completely clear to me if it is necessary even though no query is open. I see in digikam code it is done differently.

Reproducible: Always
Comment 1 Luca Carlon 2014-09-14 13:58:49 UTC
Created attachment 88701 [details]
Patch do free QSqlDatabase object before connection is removed.
Comment 2 caulier.gilles 2014-09-14 15:39:23 UTC
Marcel,

I need your feedback for this patch please.

Gilles
Comment 3 Marcel Wiesweg 2014-09-14 17:14:09 UTC
Comment on attachment 88701 [details]
Patch do free QSqlDatabase object before connection is removed.

What is the actually changed code, indentation changes set aside?
Comment 4 Luca Carlon 2014-09-14 17:29:13 UTC
A couple of brackets were added.
Comment 5 caulier.gilles 2014-09-14 19:42:44 UTC
Luca,

The 2 brackets add in void DatabaseConnectionChecker::run() must have no effect compared to previous implementation... Are you sure to have provided the right patch ?

Gilles Caulier
Comment 6 Luca Carlon 2014-09-14 21:04:23 UTC
I just checked again. The patch is what I intended. The effect of the brackets is to make the dtor of databaseHandler run before the connection is removed by QSqlDatabase::removeDatabase. Again, not sure this was strictly needed according to Qt sources as I don't see queries in the code, but the warning disappears.
Comment 7 Marcel Wiesweg 2014-09-15 18:06:14 UTC
Ok, I see.
I have never understood why these error messages appear, but they never had any adverse effects.
Patch is fine for me.
Comment 8 caulier.gilles 2014-09-15 20:42:33 UTC
Git commit 7ef60a13291e421af23559462cfb41700bc70f60 by Gilles Caulier.
Committed on 15/09/2014 at 20:41.
Pushed by cgilles into branch 'master'.

apply patch #88701 to prevent QtSQL plugin warnings
FIXED-IN: 4.4.0

M  +31   -29   app/database/databaseguierrorhandler.cpp
M  +1    -1    app/database/databaseguierrorhandler.h

http://commits.kde.org/digikam/7ef60a13291e421af23559462cfb41700bc70f60