From a95e6aa4e11bae1bfaf5940d9612b0fc34ef9705 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Sun, 12 Oct 2014 16:33:57 +0100 Subject: [PATCH] Wait for the first DatabaseWorker to be ready to declare Database as ready --- src/libtomahawk/database/Database.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libtomahawk/database/Database.cpp b/src/libtomahawk/database/Database.cpp index c71a59862..78926f438 100644 --- a/src/libtomahawk/database/Database.cpp +++ b/src/libtomahawk/database/Database.cpp @@ -306,6 +306,14 @@ Database::markAsReady() return; tLog() << Q_FUNC_INFO << "Database is ready now!"; + + // In addition to a ready index, we also need at leat one workerThread to + // be ready so that we can queue DatabaseCommands. + if ( m_workerThreads.size() > 0 && m_workerThreads.first() ) + { + m_workerThreads.first()->waitForEventLoopStart(); + } + m_ready = true; emit ready(); }