1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 03:10:12 +02:00

* Destroy Pipeline properly and deactivate it earlier during shutdown.

This commit is contained in:
Christian Muehlhaeuser
2012-02-22 02:09:24 +01:00
parent 46fd72920c
commit 413052bf8e
4 changed files with 15 additions and 9 deletions

View File

@@ -20,6 +20,7 @@
#include "artist.h"
#include "album.h"
#include "pipeline.h"
#include "sourcelist.h"
#include "utils/logger.h"
@@ -30,10 +31,14 @@ DatabaseCommand_Resolve::DatabaseCommand_Resolve( const query_ptr& query )
: DatabaseCommand()
, m_query( query )
{
Q_ASSERT( Pipeline::instance()->isRunning() );
}
DatabaseCommand_Resolve::~DatabaseCommand_Resolve()
{}
{
}
void
DatabaseCommand_Resolve::exec( DatabaseImpl* lib )

View File

@@ -61,6 +61,7 @@ Pipeline::Pipeline( QObject* parent )
Pipeline::~Pipeline()
{
tDebug() << Q_FUNC_INFO;
m_running = false;
// stop script resolvers

View File

@@ -48,6 +48,8 @@ public:
explicit Pipeline( QObject* parent = 0 );
virtual ~Pipeline();
bool isRunning() const { return m_running; }
unsigned int pendingQueryCount() const { return m_queries_pending.count(); }
unsigned int activeQueryCount() const { return m_qidsState.count(); }

View File

@@ -19,8 +19,6 @@
#include "tomahawkapp.h"
#include <iostream>
#include <QtCore/QPluginLoader>
#include <QtCore/QDir>
#include <QtCore/QMetaType>
@@ -170,7 +168,7 @@ TomahawkApp::init()
m_scanManager = QWeakPointer<ScanManager>( new ScanManager( this ) );
// init pipeline and resolver factories
new Pipeline( this );
new Pipeline();
#ifndef ENABLE_HEADLESS
Pipeline::instance()->addExternalResolverFactory( boost::bind( &QtScriptResolver::factory, _1 ) );
@@ -298,6 +296,8 @@ TomahawkApp::~TomahawkApp()
{
tLog() << "Shutting down Tomahawk...";
Pipeline::instance()->stop();
if ( !m_servent.isNull() )
delete m_servent.data();
if ( !m_scanManager.isNull() )
@@ -313,8 +313,6 @@ TomahawkApp::~TomahawkApp()
delete SipHandler::instance();
Pipeline::instance()->stop();
#ifndef ENABLE_HEADLESS
delete m_mainwindow;
#ifdef LIBATTICA_FOUND
@@ -322,11 +320,11 @@ TomahawkApp::~TomahawkApp()
#endif
#endif
delete Pipeline::instance();
if ( !m_database.isNull() )
delete m_database.data();
delete Pipeline::instance();
tLog() << "Finished shutdown.";
}
@@ -464,7 +462,6 @@ TomahawkApp::initHTTP()
tLog() << "Starting HTTPd on" << m_session.listenInterface().toString() << m_session.port();
m_session.start();
}
@@ -518,6 +515,7 @@ TomahawkApp::initServent()
}
}
// Called after Servent emits ready()
void
TomahawkApp::initSIP()