[mythtv] memory leak in MainServer::FillStatusXML

Tj htpc at treblid.dyndns.org
Wed Jul 13 01:16:15 EDT 2005


George Nassas wrote:

> On 5-Jul-05, at 11:48 AM, George Nassas wrote:
>
>> It looks like something is definitely wrong in the managed list 
>> hierarchy but I haven't quite nailed it down yet.
>
>
> Well, it seems that the problem is ManagedListGroup's itemList member 
> which is a QPtrList. Switching it to an stl list brings me to 
> stability. Everything added to the list gets destroyed OK so I guess 
> it's not cleaning up after itself internally. It feels odd that both 
> leaks I've uncovered are in the framework, I mean, sending data to an 
> output stream and creating and destroying lists are pretty common 
> operations. You'd think if there was a problem it would have appeared 
> elsewhere. Especially since QPtrList is used all over myth. It's 
> possible that the problem is with 

QPtrList is not exactly the same as std list.. Its not meant to clean up 
after itself, you can call the QPtrList object with 
"setAutoDelete(true)" to make it behave that way though... When that is 
called, the object will free up all the pointers inside on delete.

(disclaimer: that's in the QT Docs, and I personally never used any QT 
Template library much to verify this)

Probably the thing that is closest to a std list is QValueList.

> Anyhow, I'll submit something to trac within a few days. I also 
> noticed that ManagedListGroup::getValueIndex and getTextIndex are 
> using == to compare QStrings. I'll throw in a fix for no extra charge. ;)

QString objects can use the "==" operator to compare with another const 
char * or QString variable...





More information about the mythtv-dev mailing list