mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-03 20:57:52 +02:00
* Made DbCmd_DeleteDynamicPlaylist more robust.
This commit is contained in:
@@ -36,8 +36,7 @@ DatabaseCommand_DeleteDynamicPlaylist::DatabaseCommand_DeleteDynamicPlaylist( co
|
|||||||
void
|
void
|
||||||
DatabaseCommand_DeleteDynamicPlaylist::exec( DatabaseImpl* lib )
|
DatabaseCommand_DeleteDynamicPlaylist::exec( DatabaseImpl* lib )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO << "Deleting dynamic playlist:" << m_playlistguid;
|
||||||
qDebug() << "deleting dynamic playlist:" << m_playlistguid;
|
|
||||||
DatabaseCommand_DeletePlaylist::exec( lib );
|
DatabaseCommand_DeletePlaylist::exec( lib );
|
||||||
TomahawkSqlQuery cre = lib->newquery();
|
TomahawkSqlQuery cre = lib->newquery();
|
||||||
|
|
||||||
@@ -51,25 +50,27 @@ DatabaseCommand_DeleteDynamicPlaylist::exec( DatabaseImpl* lib )
|
|||||||
void
|
void
|
||||||
DatabaseCommand_DeleteDynamicPlaylist::postCommitHook()
|
DatabaseCommand_DeleteDynamicPlaylist::postCommitHook()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "..reporting..:" << m_playlistguid;
|
qDebug() << Q_FUNC_INFO << "Reporting:" << m_playlistguid;
|
||||||
if ( source().isNull() || source()->dbCollection().isNull() )
|
if ( !source() || !source()->dbCollection() )
|
||||||
{
|
{
|
||||||
qDebug() << "Source has gone offline, not emitting to GUI.";
|
Q_ASSERT( false );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// we arent sure which it is, but it can't be more th an one. so try both
|
|
||||||
|
// we arent sure which it is, but it can't be more than one. so try both
|
||||||
dynplaylist_ptr playlist = source()->dbCollection()->autoPlaylist( m_playlistguid );
|
dynplaylist_ptr playlist = source()->dbCollection()->autoPlaylist( m_playlistguid );
|
||||||
if( playlist.isNull() )
|
if ( !playlist )
|
||||||
playlist = source()->dbCollection()->station( m_playlistguid );
|
playlist = source()->dbCollection()->station( m_playlistguid );
|
||||||
|
|
||||||
tLog( LOGVERBOSE ) << "Just tried to load playlist for deletion:" << m_playlistguid << "Did we get a null one?" << playlist.isNull();
|
if ( playlist )
|
||||||
Q_ASSERT( !playlist.isNull() );
|
|
||||||
if ( !playlist.isNull() )
|
|
||||||
{
|
{
|
||||||
tLog( LOGVERBOSE ) << "is it a station?" << ( playlist->mode() == OnDemand );
|
|
||||||
playlist->reportDeleted( playlist );
|
playlist->reportDeleted( playlist );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tLog() << "ERROR: Just tried to load playlist for deletion:" << m_playlistguid << "Did we get a null one?" << playlist.isNull();
|
||||||
|
}
|
||||||
|
|
||||||
if( source()->isLocal() )
|
if ( source()->isLocal() )
|
||||||
Servent::instance()->triggerDBSync();
|
Servent::instance()->triggerDBSync();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user