[mythtv] [PATCH] Playlist feature UI tweaking

Kevin Kuphal kuphal at dls.net
Thu Jan 27 10:48:06 EST 2005


Chris Pinkham wrote:

>>Just an update on this.  I have the code in my tree and am working on 
>>it.  I have one issue with a segfault that I have to nail down when 
>>tagging an entire group and then going into Shuffle Play and I will have 
>>something to post.
>>
>>Kevin
>>    
>>
>
>Great.  It would be nice if we could get this in prior to 0.17.
>  
>
I think I found it.  In the randomize function it did a playList = 
randomList which for QStringLists makes a reference copy of the list.  
The randomPlay list is locally scoped and I think dies by the time you 
get over to playSelected which means the pointers are all messed up and 
hence the segfault.  I changed the playSelected to do this:

        ProgramInfo *tmpItem;
        QStringList::Iterator it;
        bool playNext = true;
        int i;

        while (playList.count() && playNext)
        {
            i = (int)(1.0 * playList.count() * rand() / (RAND_MAX + 1.0));
            it = playList.at(i);
            tmpItem = findMatchingProg(*it);
            if (tmpItem)
            {
                ProgramInfo *rec = new ProgramInfo(*tmpItem);
                playNext = play(rec);
                delete rec;
            }
            playList.remove(it);
        }

Which I think should accomplish the same thing without creating the 
randomList variable.  I'm not at home to test this on the box but I 
should have some time tonight and if it works, post the patch.  If you 
want, I can post the patch untested if you had a chance to look at it 
sooner.

Kevin


More information about the mythtv-dev mailing list