[mythtv] [mythtv-commits] mythtv commit: r9285 - in trunk/mythtv by kkuphal
Chris Pinkham
cpinkham at bc2va.org
Tue Mar 7 20:21:05 UTC 2006
* On Tue Mar 07, 2006 at 01:24:49PM -0600, Kevin Kuphal wrote:
> > And is this part going to cause a leak because we are setting TV::lastProgram
> > without first deleting the old one?
> >
> > while (tv->getJumpToProgram())
> > {
> > lastProgram = tv->getLastProgram();
> > ProgramInfo *tmpProgram = new ProgramInfo(*lastProgram);
> >
> > lastProgram = new ProgramInfo(*tvrec);
> > tv->setLastProgram(lastProgram);
> >
> > We get the lastProgram, make a copy of it, make a copy of tvrec,
> > then assign the copy to TV::lastProgram. Are we freeing the current
> > value in TV::lastProgram somewhere that I'm not seeing?
> >
> I *believe* it gets deleted when the progLists.clear() is executed. At
> least, I was getting a segfault when I tried to delete it in that
> section of code above because I think it was doing a double delete.
The segfault may have been happening on the first time through the loop, but I
don't think it would happen on subsequent loops.
On the "lastProgram = new ProgramInfo(*tvrec);" line above, you are creating a
new instance of ProgramInfo, so that one would not be deleted when progLists
is cleared. The next time through this loop, we lose track of the ProgramInfo
we created last time through the loop. The new tmpProgram is deleted when we delete
tvrec later down in the method.
--
Chris
More information about the mythtv-dev
mailing list