From 3142e85af6e9e9e66633ebc995ff5638a9d581a6 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 24 Feb 2013 13:59:52 +0100 Subject: [PATCH] * Print out a warning and abort when trying to enqueue a DatabaseCommand before Database is ready. --- src/libtomahawk/database/Database.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libtomahawk/database/Database.cpp b/src/libtomahawk/database/Database.cpp index 016702bfd..34e5fc752 100644 --- a/src/libtomahawk/database/Database.cpp +++ b/src/libtomahawk/database/Database.cpp @@ -120,6 +120,12 @@ void Database::enqueue( const QList< QSharedPointer >& lc ) { Q_ASSERT( m_ready ); + if ( !m_ready ) + { + tDebug() << "Can't enqueue DatabaseCommand, Database is not ready yet!"; + return; + } + tDebug( LOGVERBOSE ) << "Enqueueing" << lc.count() << "commands to rw thread"; if ( m_workerRW && m_workerRW.data()->worker() ) m_workerRW.data()->worker().data()->enqueue( lc ); @@ -130,6 +136,12 @@ void Database::enqueue( const QSharedPointer& lc ) { Q_ASSERT( m_ready ); + if ( !m_ready ) + { + tDebug() << "Can't enqueue DatabaseCommand, Database is not ready yet!"; + return; + } + if ( lc->doesMutates() ) { tDebug( LOGVERBOSE ) << "Enqueueing command to rw thread:" << lc->commandname();