Version: 1.3.3 (using KDE KDE 3.1) Installed from: Compiled From Sources OS: Linux How to reproduce: Start kscd with no cd running. Make sure it doesn't get a response from a cddb server. Press 'randomplay', 'play' and 'next title' before the cddb query times out. I already fixed it on my computer. Greets, --- kscd/kscd.cpp.orig Sun Feb 2 17:50:16 2003 +++ kscd/kscd.cpp Sun Feb 2 17:50:44 2003 @@ -1129,8 +1129,8 @@ else statuslabel->setText(i18n("Random")); - if(songListCB->count()==0) - return; + //if(songListCB->count()==0) + // return; make_random_list(); /* koz: Build a unique, once, random list */ nextClicked(); } @@ -1352,7 +1352,7 @@ /* set, the original code. */ if( randomonce ) { - if ( random_current == random_list.end() ) + if ( random_current == random_list.end() ) // TODO: Forgot to init random_current? { // playing the same random list isn't very random, is it? make_random_list(); @@ -1367,6 +1367,7 @@ } } + assert(!random_list.isEmpty()); int track = *random_current + 1; ++random_current; return track;
Created attachment 877 [details] alternate patch does this patch fix the problem as well? if so, i'd prefer to apply this one...
Subject: Re: crash on randomplay when cddb query is running > does this patch fix the problem as well? if so, i'd prefer to apply this > one... Yes, it does, and while I applied your patch I discovered another bug in the 'randomtrack()' function. If you insert no cd, activate looping, press 'random' and 'next title', the code random_current = random_list.begin(); is executed. Since random_list is empty, the value of random_current is undefined, so int track = *random_current + 1; could fail with a sigsegv. It didn't crash on my computer, still I think it is better to not rely upon undefined iterators, so I wrote some code around it. Greets, Matthias Grimrath Created an attachment (id=879) kscd-3.1-2.diff
*** Bug has been marked as fixed ***.