From 127da5014450f30d60b2db3ac9cbee698322762d Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Tue, 26 Jun 2012 18:43:07 -0400 Subject: [PATCH] Forcibly kill spotify resolver before starting out own in case it's an old one --- .../accounts/spotify/SpotifyAccount.cpp | 18 ++++++++++++++++++ .../accounts/spotify/SpotifyAccount.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/libtomahawk/accounts/spotify/SpotifyAccount.cpp b/src/libtomahawk/accounts/spotify/SpotifyAccount.cpp index 41106688d..210967ef7 100644 --- a/src/libtomahawk/accounts/spotify/SpotifyAccount.cpp +++ b/src/libtomahawk/accounts/spotify/SpotifyAccount.cpp @@ -181,6 +181,10 @@ SpotifyAccount::hookupResolver() return; } + // HACK + // Since the resolver in 0.4.x used an incompatible version of kdsingleappguard, we can't auto-kill old resolvers on the + // 0.4.x->0.5.x upgrade. So we do it manually for a while + killExistingResolvers(); m_spotifyResolver = QWeakPointer< ScriptResolver >( qobject_cast< ScriptResolver* >( Pipeline::instance()->addScriptResolver( path ) ) ); connect( m_spotifyResolver.data(), SIGNAL( changed() ), this, SLOT( resolverChanged() ) ); @@ -198,6 +202,20 @@ SpotifyAccount::hookupResolver() } +void +SpotifyAccount::killExistingResolvers() +{ + QProcess p; +#if defined(Q_OS_UNIX) + const int ret = p.execute( "killall -9 spotify_tomahawkresolver" ); + qDebug() << "Tried to killall -9 spotify_tomahawkresolver with return code:" << ret; +#elif defined(Q_OS_WIN) + const int ret = p.execute( "taskkill.exe /F /im spotify_tomahawkresolver.exe" ); + qDebug() << "Tried to taskkill.exe /F /im spotify_tomahawkresolver.exe with return code:" << ret; +#endif +} + + bool SpotifyAccount::checkForResolver() { diff --git a/src/libtomahawk/accounts/spotify/SpotifyAccount.h b/src/libtomahawk/accounts/spotify/SpotifyAccount.h index f31d97309..51b55ee44 100644 --- a/src/libtomahawk/accounts/spotify/SpotifyAccount.h +++ b/src/libtomahawk/accounts/spotify/SpotifyAccount.h @@ -126,6 +126,7 @@ private: void init(); bool checkForResolver(); void hookupResolver(); + void killExistingResolvers(); void loadPlaylists(); void clearUser( bool permanentlyDelete = false );