SVN commit 450904 by wstephens: Forward port fix for double deletion segfault when cd changes while cddb entry selection dialog is shown. M +6 -0 kaudiocreator/tracksimp.cpp M +5 -2 libkcddb/client.cpp --- trunk/KDE/kdemultimedia/kaudiocreator/tracksimp.cpp #450903:450904 @@ -258,6 +258,7 @@ // TODO Why doesn't libcddb not return MultipleRecordFound? //if( result == KCDDB::CDDB::MultipleRecordFound ) { if( Prefs::promptIfIncompleteInfo() && cddb->lookupResponse().count() > 1 ) { + QString searchedCDId = cddbInfo.id; CDInfoList cddb_info = cddb->lookupResponse(); CDInfoList::iterator it; QStringList list; @@ -293,6 +294,11 @@ return; // user pressed Cancel } + // Check that the CD we looked up is the one now loaded. + // The user might have ejected the CD while we were in the + // KInputDialog event loop, and replaced it with another one. + if ( searchedCDId != cddbInfo.id ) + return; } // Some sanity provisions to ensure that the number of records matches what --- trunk/KDE/kdemultimedia/libkcddb/client.cpp #450903:450904 @@ -215,8 +215,11 @@ emit finished( r ); - cdInfoLookup->deleteLater(); - cdInfoLookup = 0L; + if ( cdInfoLookup ) // in case someone called lookup() while finished() was being processed, and deleted cdInfoLookup. + { + cdInfoLookup->deleteLater(); + cdInfoLookup = 0L; + } } void