From 8b862774c93db71228680fc9f0f32f7627fad67f Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Sat, 5 Nov 2011 19:32:57 -0400 Subject: [PATCH] Protect-ize account members and some methods --- src/libtomahawk/accounts/account.h | 12 ++++++------ src/sip/twitter/twittersip.h | 2 +- src/sip/xmpp/xmppsip.cpp | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libtomahawk/accounts/account.h b/src/libtomahawk/accounts/account.h index 050c88725..0d62147f3 100644 --- a/src/libtomahawk/accounts/account.h +++ b/src/libtomahawk/accounts/account.h @@ -129,9 +129,14 @@ public: syncConfig(); } + virtual void sync() { QMutexLocker locker( &m_mutex ); syncConfig(); }; + +signals: + void configurationChanged(); + +protected: virtual void loadFromConfig( const QString &accountId ) { - QMutexLocker locker( &m_mutex ); m_accountId = accountId; TomahawkSettings* s = TomahawkSettings::instance(); s->beginGroup( "accounts/" + m_accountId ); @@ -147,7 +152,6 @@ public: virtual void syncConfig() { - QMutexLocker locker( &m_mutex ); TomahawkSettings* s = TomahawkSettings::instance(); s->beginGroup( "accounts/" + m_accountId ); s->setValue( "accountfriendlyname", m_accountFriendlyName ); @@ -171,10 +175,6 @@ public: QVariantMap m_acl; QStringList m_types; mutable QMutex m_mutex; - -signals: - void configurationChanged(); - }; class DLLEXPORT AccountFactory : public QObject diff --git a/src/sip/twitter/twittersip.h b/src/sip/twitter/twittersip.h index 65b7ef9f0..0da977ac6 100644 --- a/src/sip/twitter/twittersip.h +++ b/src/sip/twitter/twittersip.h @@ -94,7 +94,7 @@ private slots: void profilePicReply(); private: - inline void syncConfig() { m_account->setCredentials( m_credentials ); m_account->setConfiguration( m_configuration ); m_account->syncConfig(); } + inline void syncConfig() { m_account->setCredentials( m_credentials ); m_account->setConfiguration( m_configuration ); m_account->sync(); } bool refreshTwitterAuth(); void parseGotTomahawk( const QRegExp ®ex, const QString &screenName, const QString &text ); diff --git a/src/sip/xmpp/xmppsip.cpp b/src/sip/xmpp/xmppsip.cpp index 6a29279a3..6ac88c882 100644 --- a/src/sip/xmpp/xmppsip.cpp +++ b/src/sip/xmpp/xmppsip.cpp @@ -467,7 +467,7 @@ XmppSipPlugin::configurationChanged() QVariantHash credentials = m_account->credentials(); credentials[ "username" ] = m_currentUsername; m_account->setCredentials( credentials ); - m_account->syncConfig(); + m_account->sync(); } if ( reconnect )