1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-24 01:39:42 +01:00

All QSharedPointers used in different threads need deleteLater as custom deleter. This is some of them.

(cherry picked from commit e3f5605c4e04bd3e5dc55ccafeb2e6fb150cb1e5)
This commit is contained in:
Leo Franchi 2012-03-15 19:00:14 -04:00
parent 6e929986cb
commit e828dadec8
8 changed files with 10 additions and 10 deletions

View File

@ -61,7 +61,7 @@ Album::get( unsigned int id, const QString& name, const Tomahawk::artist_ptr& ar
return s_albums.value( id );
}
album_ptr a = album_ptr( new Album( id, name, artist ) );
album_ptr a = album_ptr( new Album( id, name, artist ), &QObject::deleteLater );
if ( id > 0 )
s_albums.insert( id, a );

View File

@ -61,7 +61,7 @@ Artist::get( unsigned int id, const QString& name )
return s_artists.value( id );
}
artist_ptr a = artist_ptr( new Artist( id, name ) );
artist_ptr a = artist_ptr( new Artist( id, name ), &QObject::deleteLater );
if ( id > 0 )
s_artists.insert( id, a );

View File

@ -142,7 +142,7 @@ DatabaseCollection::autoPlaylistCreated( const source_ptr& source, const QVarian
static_cast<GeneratorMode>(data[6].toInt()), // dynamic mode
data[7].toBool(), //shared
data[8].toInt(), //lastmod
data[9].toString() ) ); //GUID
data[9].toString() ), &QObject::deleteLater ); //GUID
addAutoPlaylist( p );
}
@ -160,7 +160,7 @@ DatabaseCollection::stationCreated( const source_ptr& source, const QVariantList
static_cast<GeneratorMode>(data[6].toInt()), // dynamic mode
data[7].toBool(), //shared
data[8].toInt(), //lastmod
data[9].toString() ) ); //GUID
data[9].toString() ), &QObject::deleteLater ); //GUID
addStation( p );
}

View File

@ -71,7 +71,7 @@ DatabaseCommand_LoadAllPlaylists::exec( DatabaseImpl* dbi )
query.value(5).toBool(), //shared
query.value(4).toInt(), //lastmod
query.value(0).toString() //GUID
) );
), &QObject::deleteLater );
plists.append( p );
}

View File

@ -185,7 +185,7 @@ Playlist::create( const source_ptr& author,
entries << p;
}
playlist_ptr playlist( new Playlist( author, guid, title, info, creator, shared, entries ) );
playlist_ptr playlist( new Playlist( author, guid, title, info, creator, shared, entries ), &QObject::deleteLater );
// save to DB in the background
// Watch for the created() signal if you need to be sure it's written.

View File

@ -152,7 +152,7 @@ DynamicPlaylist::create( const Tomahawk::source_ptr& author,
bool autoLoad
)
{
dynplaylist_ptr dynplaylist = Tomahawk::dynplaylist_ptr( new DynamicPlaylist( author, guid, title, info, creator, type, mode, shared, autoLoad ) );
dynplaylist_ptr dynplaylist = Tomahawk::dynplaylist_ptr( new DynamicPlaylist( author, guid, title, info, creator, type, mode, shared, autoLoad ), &QObject::deleteLater );
DatabaseCommand_CreateDynamicPlaylist* cmd = new DatabaseCommand_CreateDynamicPlaylist( author, dynplaylist, autoLoad );
connect( cmd, SIGNAL(finished()), dynplaylist.data(), SIGNAL(created()) );

View File

@ -44,7 +44,7 @@ Query::get( const QString& artist, const QString& track, const QString& album, c
if ( qid.isEmpty() )
autoResolve = false;
query_ptr q = query_ptr( new Query( artist, track, album, qid, autoResolve ) );
query_ptr q = query_ptr( new Query( artist, track, album, qid, autoResolve ), &QObject::deleteLater );
q->setWeakRef( q.toWeakRef() );
if ( autoResolve )
@ -58,7 +58,7 @@ query_ptr
Query::get( const QString& query, const QID& qid )
{
query_ptr q = query_ptr( new Query( query, qid ) );
query_ptr q = query_ptr( new Query( query, qid ), &QObject::deleteLater );
q->setWeakRef( q.toWeakRef() );
if ( !qid.isEmpty() )

View File

@ -43,7 +43,7 @@ Result::get( const QString& url )
return s_results.value( url );
}
result_ptr r = result_ptr( new Result( url ) );
result_ptr r = result_ptr( new Result( url ), &QObject::deleteLater );
s_results.insert( url, r );
return r;