mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
Catch boost::unitialized_future if it is thrown
This commit is contained in:
@@ -164,15 +164,23 @@ Album::id() const
|
|||||||
|
|
||||||
if ( waiting )
|
if ( waiting )
|
||||||
{
|
{
|
||||||
finalId = m_idFuture.get();
|
try
|
||||||
|
{
|
||||||
|
finalId = m_idFuture.get();
|
||||||
|
|
||||||
s_idMutex.lockForWrite();
|
s_idMutex.lockForWrite();
|
||||||
m_id = finalId;
|
m_id = finalId;
|
||||||
m_waitingForId = false;
|
m_waitingForId = false;
|
||||||
|
|
||||||
if ( m_id > 0 )
|
if ( m_id > 0 )
|
||||||
s_albumsById[ m_id ] = m_ownRef.toStrongRef();
|
s_albumsById[ m_id ] = m_ownRef.toStrongRef();
|
||||||
s_idMutex.unlock();
|
s_idMutex.unlock();
|
||||||
|
}
|
||||||
|
catch( 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalId;
|
return finalId;
|
||||||
|
@@ -244,15 +244,23 @@ Artist::id() const
|
|||||||
|
|
||||||
if ( waiting )
|
if ( waiting )
|
||||||
{
|
{
|
||||||
finalid = m_idFuture.get();
|
try
|
||||||
|
{
|
||||||
|
finalid = m_idFuture.get();
|
||||||
|
|
||||||
s_idMutex.lockForWrite();
|
s_idMutex.lockForWrite();
|
||||||
m_id = finalid;
|
m_id = finalid;
|
||||||
m_waitingForFuture = false;
|
m_waitingForFuture = false;
|
||||||
|
|
||||||
if ( m_id > 0 )
|
if ( m_id > 0 )
|
||||||
s_artistsById[ m_id ] = m_ownRef.toStrongRef();
|
s_artistsById[ m_id ] = m_ownRef.toStrongRef();
|
||||||
s_idMutex.unlock();
|
s_idMutex.unlock();
|
||||||
|
}
|
||||||
|
catch( 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_id;
|
return m_id;
|
||||||
|
Reference in New Issue
Block a user