CVS commit by benb: Fixed a bug in kSlideShowSaver::loadNextImage() that causes an infinite recursion (and thus a crash) if the file list is non-empty but contains no loadable images. Reported as Debian bug #246767. M +7 -6 slideshow.cpp 1.22 --- kdeartwork/kscreensaver/kdesavers/slideshow.cpp #1.21:1.22 @@ -811,6 +811,4 @@ void kSlideShowSaver::loadNextImage() int num; - if (mShowRandom) - { num = mFileList.count(); if (num <= 0) //no files in the directory @@ -818,4 +816,7 @@ void kSlideShowSaver::loadNextImage() return; } + + if (mShowRandom) + { mFileIdx = rand() % num; fname = mFileList[mFileIdx]; @@ -828,5 +829,4 @@ void kSlideShowSaver::loadNextImage() else { - num = mFileList.count(); if (mFileIdx >= num) mFileIdx = 0; fname = mFileList[mFileIdx]; @@ -837,4 +837,5 @@ void kSlideShowSaver::loadNextImage() kdDebug() << "Failed to load image " << fname << endl; mFileList.remove(fname); + mRandomList.remove(fname); if (!mFileList.isEmpty()) loadNextImage();