1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 00:54:20 +02:00

* Print out a warning and abort when trying to enqueue a DatabaseCommand before Database is ready.

This commit is contained in:
Christian Muehlhaeuser
2013-02-24 13:59:52 +01:00
parent 6d788a00af
commit 3142e85af6

View File

@@ -120,6 +120,12 @@ void
Database::enqueue( const QList< QSharedPointer<DatabaseCommand> >& lc ) Database::enqueue( const QList< QSharedPointer<DatabaseCommand> >& lc )
{ {
Q_ASSERT( m_ready ); 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"; tDebug( LOGVERBOSE ) << "Enqueueing" << lc.count() << "commands to rw thread";
if ( m_workerRW && m_workerRW.data()->worker() ) if ( m_workerRW && m_workerRW.data()->worker() )
m_workerRW.data()->worker().data()->enqueue( lc ); m_workerRW.data()->worker().data()->enqueue( lc );
@@ -130,6 +136,12 @@ void
Database::enqueue( const QSharedPointer<DatabaseCommand>& lc ) Database::enqueue( const QSharedPointer<DatabaseCommand>& lc )
{ {
Q_ASSERT( m_ready ); Q_ASSERT( m_ready );
if ( !m_ready )
{
tDebug() << "Can't enqueue DatabaseCommand, Database is not ready yet!";
return;
}
if ( lc->doesMutates() ) if ( lc->doesMutates() )
{ {
tDebug( LOGVERBOSE ) << "Enqueueing command to rw thread:" << lc->commandname(); tDebug( LOGVERBOSE ) << "Enqueueing command to rw thread:" << lc->commandname();