[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 213097] Amarok crashes when deleting tracks from ipod
From:       Martin Aumueller <aumuell () reserv ! at>
Date:       2010-03-08 23:18:27
Message-ID: 20100308231827.9A66C360B3 () immanuel ! kde ! org
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=213097


Martin Aumueller <aumuell@reserv.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #16 from Martin Aumueller <aumuell reserv at>  2010-03-09 00:18:21 ---
commit c12719082d172f291afec9897e2cbebbaaf82e75
Author: Martin Aumà ¼ller <aumuell@reserv.at>
Date:   Tue Mar 9 00:12:38 2010 +0100

    fix crashes when deleting songs from an ipod

    The ipod media device plugin's internal list of files was not correctly
updated
    when tracks have been copied to an ipod or when orphaned tracks have been
added.
    This resulted in songs being added to the ipod's database multiple times.
Fix that
    and try to work around problems resulting from the invalid databases
containing
    several entries for the same file.

    BUG: 213097

diff --git a/ChangeLog b/ChangeLog
index 2c67ebb..51be1a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,8 @@ VERSION 2.3
       last check.

   BUGFIXES:
+    * Fix crashes when scanning for orphaned tracks immediately after adding
tracks
+      to an iPod. (BR 213097)
     * Made cover urls for tracks from Jamendo, Magnatune and scripted services
       available using DBus.
     * When an audio CD track is chosen manually, make it active in the
playlist
diff --git a/src/collection/ipodcollection/handler/IpodHandler.cpp
b/src/collection/ipodcollection/handler/IpodHandler.cpp
index 5be4638..fd7afa7 100644
--- a/src/collection/ipodcollection/handler/IpodHandler.cpp
+++ b/src/collection/ipodcollection/handler/IpodHandler.cpp
@@ -550,6 +550,14 @@ IpodHandler::addNextOrphaned()

     m_itdbtrackhash[ destTrack ]->ipod_path = g_strdup( path.toLatin1() );

+    // add to list of files on device
+
+    const QString key(path.toLower().toLatin1());
+    if( m_files.value(key) )
+       debug() << "duplicate track" << key;
+    else
+       m_files.insert( key, m_itdbtrackhash[ destTrack ] );
+
     // Add the track struct into the database

     addTrackInDB( destTrack );
@@ -1757,6 +1765,11 @@ IpodHandler::libSetPlayableUrl(
Meta::MediaDeviceTrackPtr &destTrack, const Meta
     debug() << "Path before put in ipod_path: " << pathname;

     m_itdbtrackhash[ destTrack ]->ipod_path = g_strdup(
ipodPath(pathname).toLatin1() );
+    const QString key(ipodPath(pathname).toLower());
+    if( m_files.value(key) )
+       debug() << "duplicate track" << key;
+    else
+       m_files.insert(key, m_itdbtrackhash[ destTrack ] );
     debug() << "on iPod: " << m_itdbtrackhash[ destTrack ]->ipod_path;
     setDatabaseChanged();
 }
@@ -2013,7 +2026,11 @@ void
 IpodHandler::setAssociateTrack( const Meta::MediaDeviceTrackPtr track )
 {
     m_itdbtrackhash[ track ] = m_currtrack;
-    m_files.insert( QString(m_currtrack->ipod_path).toLower(), m_currtrack );
+    const QString key(m_currtrack->ipod_path);
+    if( m_files.value(key) )
+       debug() << "duplicate track" << key;
+    else
+       m_files.insert( key, m_currtrack );
 }

 QStringList

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic