mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 03:10:12 +02:00
Add some asserts to guarantee no access to Database before it's ready
This commit is contained in:
@@ -82,6 +82,7 @@ Database::loadIndex()
|
|||||||
void
|
void
|
||||||
Database::enqueue( const QList< QSharedPointer<DatabaseCommand> >& lc )
|
Database::enqueue( const QList< QSharedPointer<DatabaseCommand> >& lc )
|
||||||
{
|
{
|
||||||
|
Q_ASSERT( m_ready );
|
||||||
qDebug() << "Enqueueing" << lc.count() << "commands to rw thread";
|
qDebug() << "Enqueueing" << lc.count() << "commands to rw thread";
|
||||||
m_workerRW->enqueue( lc );
|
m_workerRW->enqueue( lc );
|
||||||
}
|
}
|
||||||
@@ -90,6 +91,7 @@ Database::enqueue( const QList< QSharedPointer<DatabaseCommand> >& lc )
|
|||||||
void
|
void
|
||||||
Database::enqueue( const QSharedPointer<DatabaseCommand>& lc )
|
Database::enqueue( const QSharedPointer<DatabaseCommand>& lc )
|
||||||
{
|
{
|
||||||
|
Q_ASSERT( m_ready );
|
||||||
if ( lc->doesMutates() )
|
if ( lc->doesMutates() )
|
||||||
{
|
{
|
||||||
qDebug() << "Enqueueing command to rw thread:" << lc->commandname();
|
qDebug() << "Enqueueing command to rw thread:" << lc->commandname();
|
||||||
@@ -134,6 +136,7 @@ Database::enqueue( const QSharedPointer<DatabaseCommand>& lc )
|
|||||||
DatabaseImpl*
|
DatabaseImpl*
|
||||||
Database::impl()
|
Database::impl()
|
||||||
{
|
{
|
||||||
|
Q_ASSERT( m_ready );
|
||||||
QMutexLocker lock( &m_mutex );
|
QMutexLocker lock( &m_mutex );
|
||||||
|
|
||||||
QThread* thread = QThread::currentThread();
|
QThread* thread = QThread::currentThread();
|
||||||
|
Reference in New Issue
Block a user