1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-05 08:32:42 +02:00

Revert "Remove one of the parenting warnings."

This reverts commit a1146fbe535bbf60d00d3f4d733f202fafbb3157.
This commit is contained in:
Jeff Mitchell 2012-06-21 16:13:24 -04:00
parent a1146fbe53
commit e3783b58e4
3 changed files with 13 additions and 14 deletions

View File

@ -138,9 +138,7 @@ Database::impl()
QThread* thread = QThread::currentThread();
if ( !m_implHash.contains( thread ) )
{
QPair< QString, QString > args = m_impl->cloneArgs();
DatabaseImpl* impl = new DatabaseImpl( args.first, args.second );
impl->setFuzzyIndex( m_impl->fuzzyIndex() );
DatabaseImpl* impl = m_impl->clone();
m_implHash.insert( thread, impl );
}

View File

@ -85,12 +85,12 @@ DatabaseImpl::DatabaseImpl( const QString& dbname )
}
DatabaseImpl::DatabaseImpl( const QString &dbname, const QString &dbid )
DatabaseImpl::DatabaseImpl( const QString& dbname, bool internal )
: QObject( (QObject*) QThread::currentThread() )
{
Q_UNUSED( internal );
openDatabase( dbname, false );
init();
m_dbid = dbid;
}
@ -142,12 +142,15 @@ DatabaseImpl::database()
}
QPair< QString, QString >
DatabaseImpl::cloneArgs() const
DatabaseImpl*
DatabaseImpl::clone() const
{
QMutexLocker lock( &m_mutex );
QPair< QString, QString > args( m_db.databaseName(), m_dbid );
return args;
DatabaseImpl* impl = new DatabaseImpl( m_db.databaseName(), true );
impl->setDatabaseID( m_dbid );
impl->setFuzzyIndex( m_fuzzyIndex );
return impl;
}

View File

@ -48,7 +48,7 @@ public:
DatabaseImpl( const QString& dbname );
~DatabaseImpl();
QPair< QString, QString > cloneArgs() const;
DatabaseImpl* clone() const;
TomahawkSqlQuery newquery();
QSqlDatabase& database();
@ -82,9 +82,9 @@ signals:
void indexReady();
private:
DatabaseImpl( const QString &dbname, const QString &dbid );
FuzzyIndex* fuzzyIndex() const { return m_fuzzyIndex; }
DatabaseImpl( const QString& dbname, bool internal );
void setFuzzyIndex( FuzzyIndex* fi ) { m_fuzzyIndex = fi; }
void setDatabaseID( const QString& dbid ) { m_dbid = dbid; }
void init();
bool openDatabase( const QString& dbname, bool checkSchema = true );
@ -101,8 +101,6 @@ private:
QString m_dbid;
FuzzyIndex* m_fuzzyIndex;
mutable QMutex m_mutex;
friend class Database;
};
#endif // DATABASEIMPL_H