From 6a605789e1f8abe697856ad464863409b2501ed0 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Tue, 29 Mar 2011 07:41:04 +0800 Subject: [PATCH 1/3] fixed typo - changed "indemify" to "indemnify" --- src/sip/SipHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sip/SipHandler.cpp b/src/sip/SipHandler.cpp index a8284a93e..b07eb796c 100644 --- a/src/sip/SipHandler.cpp +++ b/src/sip/SipHandler.cpp @@ -183,7 +183,7 @@ SipHandler::connectPlugins( bool startup, const QString &pluginName ) { int result = QMessageBox::question( TomahawkApp::instance()->mainWindow(), "Legal Warning", - "By pressing OK below, you agree that your use of Tomahawk will be in accordance with any applicable laws, including copyright and intellectual property laws, in effect in your country of residence, and indemify the Tomahawk developers and project from liability should you choose to break those laws.\n\nFor more information, please see http://gettomahawk.com/legal", + "By pressing OK below, you agree that your use of Tomahawk will be in accordance with any applicable laws, including copyright and intellectual property laws, in effect in your country of residence, and indemnify the Tomahawk developers and project from liability should you choose to break those laws.\n\nFor more information, please see http://gettomahawk.com/legal", "I Do Not Agree", "I Agree" ); if ( result != 1 ) From 0a0e27c717c056c798fcffca128d896ebc136ab8 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Tue, 29 Mar 2011 09:58:14 -0400 Subject: [PATCH 2/3] Hopefully fix TWK-13 crash bug. --- src/sip/twitter/twitter.cpp | 68 +++++++++++++------------------------ 1 file changed, 24 insertions(+), 44 deletions(-) diff --git a/src/sip/twitter/twitter.cpp b/src/sip/twitter/twitter.cpp index 843de4505..d74481ab3 100644 --- a/src/sip/twitter/twitter.cpp +++ b/src/sip/twitter/twitter.cpp @@ -54,12 +54,10 @@ TwitterPlugin::TwitterPlugin() m_checkTimer.setInterval( 60000 ); m_checkTimer.setSingleShot( false ); connect( &m_checkTimer, SIGNAL( timeout() ), SLOT( checkTimerFired() ) ); - m_checkTimer.start(); m_connectTimer.setInterval( 60000 ); m_connectTimer.setSingleShot( false ); connect( &m_connectTimer, SIGNAL( timeout() ), SLOT( connectTimerFired() ) ); - m_connectTimer.start(); } void @@ -144,12 +142,14 @@ TwitterPlugin::connectPlugin( bool /*startup*/ ) bool TwitterPlugin::refreshTwitterAuth() { + if( !m_twitterAuth.isNull() ) + delete m_twitterAuth.data(); m_twitterAuth = QWeakPointer( new TomahawkOAuthTwitter( this ) ); - - TomahawkSettings *settings = TomahawkSettings::instance(); - - if ( m_twitterAuth.isNull() ) + + if( m_twitterAuth.isNull() ) return false; + + TomahawkSettings *settings = TomahawkSettings::instance(); m_twitterAuth.data()->setNetworkAccessManager( TomahawkUtils::nam() ); m_twitterAuth.data()->setOAuthToken( settings->twitterOAuthToken().toLatin1() ); @@ -162,14 +162,23 @@ void TwitterPlugin::disconnectPlugin() { qDebug() << Q_FUNC_INFO; + m_checkTimer.stop(); + m_connectTimer.stop(); if( !m_friendsTimeline.isNull() ) - m_friendsTimeline.data()->deleteLater(); + delete m_friendsTimeline.data(); + if( !m_mentions.isNull() ) + delete m_mentions.data(); + if( !m_directMessages.isNull() ) + delete m_directMessages.data(); + if( !m_directMessageNew.isNull() ) + delete m_directMessageNew.data(); + if( !m_directMessageDestroy.isNull() ) + delete m_directMessageDestroy.data(); if( !m_twitterAuth.isNull() ) - m_twitterAuth.data()->deleteLater(); - + delete m_twitterAuth.data(); + m_cachedPeers.empty(); m_attemptedConnects.empty(); - delete m_twitterAuth.data(); m_isOnline = false; } @@ -200,6 +209,8 @@ TwitterPlugin::connectAuthVerifyReply( const QTweetUser &user ) connect( m_directMessageNew.data(), SIGNAL( error(QTweetNetBase::ErrorCode, const QString &) ), SLOT( directMessagePostError(QTweetNetBase::ErrorCode, const QString &) ) ); connect( m_directMessageDestroy.data(), SIGNAL( parsedDirectMessage(const QTweetDMStatus &) ), SLOT( directMessageDestroyed(const QTweetDMStatus &) ) ); m_isOnline = true; + m_connectTimer.start(); + m_checkTimer.start(); QMetaObject::invokeMethod( this, "checkTimerFired", Qt::AutoConnection ); QTimer::singleShot( 20000, this, SLOT( connectTimerFired() ) ); } @@ -223,32 +234,16 @@ TwitterPlugin::connectAuthVerifyReply( const QTweetUser &user ) void TwitterPlugin::checkTimerFired() { - if ( !isValid() ) + if ( !isValid() || m_twitterAuth.isNull() ) return; - if ( m_twitterAuth.isNull() ) - { - if ( refreshTwitterAuth() ) - { - QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( m_twitterAuth.data(), this ); - connect( credVerifier, SIGNAL( parsedUser(const QTweetUser &) ), SLOT( connectAuthVerifyReply(const QTweetUser &) ) ); - credVerifier->verify(); - } - else - { - qDebug() << "TwitterPlugin auth went null somehow and could not refresh"; - return; - } - } - if ( m_cachedFriendsSinceId == 0 ) m_cachedFriendsSinceId = TomahawkSettings::instance()->twitterCachedFriendsSinceId(); qDebug() << "TwitterPlugin looking at friends timeline since id " << m_cachedFriendsSinceId; if ( !m_friendsTimeline.isNull() ) - m_friendsTimeline.data()->fetch( m_cachedFriendsSinceId, 0, 800 ); - + m_friendsTimeline.data()->fetch( m_cachedFriendsSinceId, 0, 800 ); if ( m_cachedMentionsSinceId == 0 ) m_cachedMentionsSinceId = TomahawkSettings::instance()->twitterCachedMentionsSinceId(); @@ -262,24 +257,9 @@ TwitterPlugin::checkTimerFired() void TwitterPlugin::connectTimerFired() { - if ( !isValid() || m_cachedPeers.isEmpty() ) + if ( !isValid() || m_cachedPeers.isEmpty() || m_twitterAuth.isNull() ) return; - if ( m_twitterAuth.isNull() ) - { - if ( refreshTwitterAuth() ) - { - QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( m_twitterAuth.data(), this ); - connect( credVerifier, SIGNAL( parsedUser(const QTweetUser &) ), SLOT( connectAuthVerifyReply(const QTweetUser &) ) ); - credVerifier->verify(); - } - else - { - qDebug() << "TwitterPlugin auth went null somehow and could not refresh"; - return; - } - } - QString myScreenName = TomahawkSettings::instance()->twitterScreenName(); QList peerlist = m_cachedPeers.keys(); qStableSort( peerlist.begin(), peerlist.end() ); From b59399aecba8602ec753708c81dbdfc16002d2bc Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Tue, 29 Mar 2011 16:22:08 -0400 Subject: [PATCH 3/3] Changelogify --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 89a441c90..c3a791448 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ Version 0.0.3: + * Fix crashes in Twitter authentication. For reals now. * Properly honor the chosen port number if a static host and port are marked as preferred.