[Amarok] Huge performance improvements for the Cover Manage

Seb Ruiz ruiz at kde.org
Fri Oct 16 08:25:31 CEST 2009


2009/10/16 Mark Kretschmann <kretschmann at kde.org>:
> -    if( !m_hasImageChecked )
> -        m_hasImage = ! const_cast<SqlAlbum*>( this )->image( size ).isNull();
> +    if( !m_hasImageChecked ) {
> +
> +        m_hasImageChecked = true;
> +
> +        QString image = const_cast<SqlAlbum*>( this )->findImage( size );
> +
> +        // The user has explicitly set no cover
> +        if( image == AMAROK_UNSET_MAGIC )
> +            m_hasImage = false;
> +        else m_hasImage = !image.isEmpty();
> +    }
> +

Long lived caches can be dangerous. This introduces a defect: you
aren't clearing the value of m_hasImage and m_hasImageChecked  when
unsetting an album cover.

-- 
Seb Ruiz

http://www.sebruiz.net/
http://amarok.kde.org/


More information about the Amarok-devel mailing list