From ba74c22663f6a027c34bd4a77359565ac87a61b8 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Mon, 16 Jan 2012 13:33:10 +0100 Subject: [PATCH] * Potential malloc / race condition fix. --- src/libtomahawk/source.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libtomahawk/source.cpp b/src/libtomahawk/source.cpp index b73eae7c1..9d96792db 100644 --- a/src/libtomahawk/source.cpp +++ b/src/libtomahawk/source.cpp @@ -361,6 +361,13 @@ Source::addCommand( const QSharedPointer& command ) void Source::executeCommands() { + if ( QThread::currentThread() != thread() ) + { + tDebug() << "Reinvoking in correct thread:" << Q_FUNC_INFO; + QMetaObject::invokeMethod( this, "executeCommands", Qt::QueuedConnection ); + return; + } + if ( !m_cmds.isEmpty() ) { QList< QSharedPointer > cmdGroup;