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

List:       kde-commits
Subject:    branches/KDE/3.5/kdemultimedia
From:       Will Stephenson <lists () stevello ! free-online ! co ! uk>
Date:       2005-08-19 12:52:17
Message-ID: 1124455937.169338.18377.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 450896 by wstephens:

Fix segfault due to double deletion.
When the CD is ejected and the choose CDDB entry dialog is showing, and
a second CD is inserted, cdInfoLookup is deleted on the second lookup()
call, and then after the first dialog is dismissed, Client tries to
deleteLater() it again.

Prevent this and add another sanity check to kaudiocreator to detect if
the disk changed while we were waiting for input.



 M  +6 -0      kaudiocreator/tracksimp.cpp  
 M  +5 -2      libkcddb/client.cpp  


--- branches/KDE/3.5/kdemultimedia/kaudiocreator/tracksimp.cpp #450895:450896
@@ -259,6 +259,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;
@@ -294,6 +295,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
--- branches/KDE/3.5/kdemultimedia/libkcddb/client.cpp #450895:450896
@@ -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


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

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