[mythtv] memory leak in MainServer::FillStatusXML

Isaac Richards ijr at case.edu
Tue Jul 5 12:15:07 EDT 2005

On Tuesday 05 July 2005 11:48 am, George Nassas wrote:
> On 5-Jul-05, at 12:48 AM, Isaac Richards wrote:
> >> but I have noticed that RootSRGroup is using the compiler-supplied
> >> copy
> >> constructor for ScheduledRecording. Is this intentional?
> >
> > It shouldn't be using a copy of the object like that, no.
> >
> >> My understanding is in these cases memcpy will be used and that's
> >> definitely incompatible with the QStrings contained in that class.
> >> FWIW
> >
> > Not true.  It'll use defined copy-constructors if they exist, which is
> > completely safe for QString.
> OK, I must have forgotten that one among the hundreds of other C++
> gotchas. In any case all the SR* subclasses don't need reference
> members to their parent, particularly at destruction time when each of
> them tries to destroy the parent that's currently destroying them. I
> replaced the references with pointers. 

That's a reasonable change.

> I also noticed that the classes 
> in managedlist.h and settings.h are managed through pointers to a base
> class but the majority of them are lacking virtual destructors. Fixing
> those things makes valgrind happier but I still haven't found that
> elusive last memory leak. It looks like something is definitely wrong
> in the managed list hierarchy but I haven't quite nailed it down yet.

Only the top level base class needs a virtual destructor.  If a base has a 
virtual destructor, any classes inheriting off of it automatically have 
virtual destructors.  


More information about the mythtv-dev mailing list