From 2c91365cbb27a4b7bd63e87b7ca61466dbf8270d Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 22 Jun 2012 03:35:02 +0200 Subject: [PATCH] * Dont exec the app when loading as a secondary instance. --- src/TomahawkApp.cpp | 7 +++++-- src/main.cpp | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/TomahawkApp.cpp b/src/TomahawkApp.cpp index e7156ed81..e55f669f8 100644 --- a/src/TomahawkApp.cpp +++ b/src/TomahawkApp.cpp @@ -121,6 +121,9 @@ using namespace Tomahawk; TomahawkApp::TomahawkApp( int& argc, char *argv[] ) : TOMAHAWK_APPLICATION( argc, argv ) +#ifndef ENABLE_HEADLESS + , m_mainwindow( 0 ) +#endif , m_headless( false ) , m_loaded( false ) { @@ -188,7 +191,6 @@ TomahawkApp::init() #ifdef ENABLE_HEADLESS m_headless = true; #else - m_mainwindow = 0; m_headless = arguments().contains( "--headless" ); setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) ); setQuitOnLastWindowClosed( false ); @@ -360,7 +362,8 @@ TomahawkApp::~TomahawkApp() if ( !m_connector.isNull() ) delete m_connector.data(); - Pipeline::instance()->stop(); + if ( Pipeline::instance() ) + Pipeline::instance()->stop(); if ( !m_servent.isNull() ) delete m_servent.data(); diff --git a/src/main.cpp b/src/main.cpp index 73be2e9ba..efaec33ad 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -166,7 +166,10 @@ main( int argc, char *argv[] ) a.loadUrl( arg ); } - int returnCode = a.exec(); + int returnCode = 0; + if ( guard.isPrimaryInstance() ) + returnCode = a.exec(); + #ifdef Q_OS_WIN // clean up keyboard hook if ( hKeyboardHook )