diff --git a/src/tomahawk/TomahawkApp.cpp b/src/tomahawk/TomahawkApp.cpp index bcaecb386..831248c55 100644 --- a/src/tomahawk/TomahawkApp.cpp +++ b/src/tomahawk/TomahawkApp.cpp @@ -285,9 +285,6 @@ TomahawkApp::~TomahawkApp() if ( !m_scanManager.isNull() ) delete m_scanManager.data(); - if ( !m_audioEngine.isNull() ) - delete m_audioEngine.data(); - delete Tomahawk::Accounts::AccountManager::instance(); #ifndef ENABLE_HEADLESS @@ -295,6 +292,10 @@ TomahawkApp::~TomahawkApp() delete m_mainwindow; #endif + // Main Window uses the AudioEngine, so delete it later. + if ( !m_audioEngine.isNull() ) + delete m_audioEngine.data(); + if ( !m_database.isNull() ) delete m_database.data();