From 502db675107e441a9c25c8e9f8ebc36f90bd36f2 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Mon, 20 Feb 2012 15:45:43 -0500 Subject: [PATCH] don't crash on exit --- src/libtomahawk/accounts/LastFmAccount.cpp | 8 ++++---- src/libtomahawk/accounts/LastFmAccount.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libtomahawk/accounts/LastFmAccount.cpp b/src/libtomahawk/accounts/LastFmAccount.cpp index 4e97fcb95..758130fb2 100644 --- a/src/libtomahawk/accounts/LastFmAccount.cpp +++ b/src/libtomahawk/accounts/LastFmAccount.cpp @@ -51,7 +51,7 @@ LastFmAccountFactory::icon() const LastFmAccount::LastFmAccount( const QString& accountId ) : Account( accountId ) { - m_infoPlugin = new LastFmPlugin( this ); + m_infoPlugin = QWeakPointer< LastFmPlugin >( new LastFmPlugin( this ) ); setAccountFriendlyName( "Last.Fm" ); m_icon.load( RESPATH "images/lastfm-icon.png" ); @@ -60,7 +60,7 @@ LastFmAccount::LastFmAccount( const QString& accountId ) LastFmAccount::~LastFmAccount() { - delete m_infoPlugin; + delete m_infoPlugin.data(); delete m_resolver.data(); } @@ -106,7 +106,7 @@ LastFmAccount::icon() const InfoPlugin* LastFmAccount::infoPlugin() { - return m_infoPlugin; + return m_infoPlugin.data(); } bool @@ -126,7 +126,7 @@ LastFmAccount::saveConfig() setScrobble( m_configWidget.data()->scrobble() ); } - m_infoPlugin->settingsChanged(); + m_infoPlugin.data()->settingsChanged(); } diff --git a/src/libtomahawk/accounts/LastFmAccount.h b/src/libtomahawk/accounts/LastFmAccount.h index 1ab607be4..0dc9d4c79 100644 --- a/src/libtomahawk/accounts/LastFmAccount.h +++ b/src/libtomahawk/accounts/LastFmAccount.h @@ -91,7 +91,7 @@ public: private: bool m_authenticated; QWeakPointer m_resolver; - Tomahawk::InfoSystem::LastFmPlugin* m_infoPlugin; + QWeakPointer m_infoPlugin; QWeakPointer m_configWidget; QPixmap m_icon; };