From a8f0053fc8b68cfff0ff6a7ec383c4ba43e539b9 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sun, 17 Jun 2012 15:30:27 +0200 Subject: [PATCH] Catch by const ref and assert to check hypothesis --- src/libtomahawk/Album.cpp | 4 +++- src/libtomahawk/Artist.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libtomahawk/Album.cpp b/src/libtomahawk/Album.cpp index 35c3db7a9..0995a2f0f 100644 --- a/src/libtomahawk/Album.cpp +++ b/src/libtomahawk/Album.cpp @@ -176,10 +176,12 @@ Album::id() const s_albumsById[ m_id ] = m_ownRef.toStrongRef(); s_idMutex.unlock(); } - catch( boost::future_uninitialized& e ) + catch( const boost::future_uninitialized& e ) { qWarning() << "Caught boost::future_uninitialized when trying to get artist id from future, WTF?"; qWarning() << "Potential race condition, do we have an ID?" << m_id << "and waiting?" << m_waitingForId << e.what(); + + Q_ASSERT( !m_waitingForId ); } } diff --git a/src/libtomahawk/Artist.cpp b/src/libtomahawk/Artist.cpp index aaca5b52d..16b70efc2 100644 --- a/src/libtomahawk/Artist.cpp +++ b/src/libtomahawk/Artist.cpp @@ -256,10 +256,12 @@ Artist::id() const s_artistsById[ m_id ] = m_ownRef.toStrongRef(); s_idMutex.unlock(); } - catch( boost::future_uninitialized& e ) + catch( const boost::future_uninitialized& e ) { qWarning() << "Caught boost::future_uninitialized when trying to get artist id from future, WTF?"; qWarning() << "Potential race condition, do we have an ID?" << m_id << "and waiting?" << m_waitingForFuture << e.what(); + + Q_ASSERT( !m_waitingForFuture ); } }