diff options
author | Jan Klass <kissaki@posteo.de> | 2018-06-18 00:11:17 +0300 |
---|---|---|
committer | Jan Klass <kissaki@posteo.de> | 2018-06-18 21:27:08 +0300 |
commit | 222def784593bfa5f7960f6c2ce0d299568c2cc9 (patch) | |
tree | 0bc5676117dd769522df3d97e8a9b4aafa86f114 /src/mumble/ACLEditor.cpp | |
parent | a092a444c523c524013b2bb5c5cf4527870d033a (diff) |
Fix #3411: Threaded access to Database
Qt5 documents that QSqlDatabase must not be called from varying threads.
An instance must be limited to its thread.
In Mumble the Database class handles database access.
Up to now it contained static methods and always used the global default
database instance.
We instantiate the default database connection into the Global context.
It is mostly used from the main event loop, but also from a thread in
ServerHandler.
This is broken as per specification, and Qt 5.11 seems to finally enforce
that.
To resolve this issue, we promote Database to an instantiable class,
use the created Global context class instance from the event loop,
and a distinct Database instance (and connection) from the ServerHandler
instance (and thread).
Diffstat (limited to 'src/mumble/ACLEditor.cpp')
-rw-r--r-- | src/mumble/ACLEditor.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mumble/ACLEditor.cpp b/src/mumble/ACLEditor.cpp index eca4e66ef..8a53a940e 100644 --- a/src/mumble/ACLEditor.cpp +++ b/src/mumble/ACLEditor.cpp @@ -268,7 +268,7 @@ void ACLEditor::accept() { const QString &descriptionText = rteChannelDescription->text(); mpcs.set_description(u8(descriptionText)); needs_update = true; - Database::setBlob(sha1(descriptionText), descriptionText.toUtf8()); + g.db->setBlob(sha1(descriptionText), descriptionText.toUtf8()); } if (pChannel->iPosition != qsbChannelPosition->value()) { mpcs.set_position(qsbChannelPosition->value()); |