[mythtv] delete vs delete[] in dvbrecorder destructor

Tj htpc at treblid.dyndns.org
Tue Feb 22 12:22:25 UTC 2005


John Pullan wrote:

>These should be delete[]'s 
>  
>
Does it really make a difference?

I did a backtrace and mythbackend appears to crash at dvbrecorder:341 
and a corrupted stack error. Is the corrupted stack caused by delete or 
is it because of something else (e.g. gcc optimisations)?

Also changed 'Iterator es' to 'const_iterator es' in the hopes it may 
stop mythbackend from crashing my machine occassionally after finishing 
a recording (and also a little bit faster).

Attached is a simple patch for anyone who is interested to test this 
out/look at.

Lastly, what's the policy of using smart pointers like std::auto_ptr and 
STL like map, etc in Myth?


Regards.

-------------- next part --------------
Index: libs/libmythtv/dvbrecorder.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/dvbrecorder.cpp,v
retrieving revision 1.44
diff -r1.44 dvbrecorder.cpp
100,101c100,101
<     delete pat_pkt;
<     delete pmt_pkt;
---
>     delete[] pat_pkt;
>     delete[] pmt_pkt;
341c341
<     QValueList<ElementaryPIDObject>::Iterator es;
---
>     QValueList<ElementaryPIDObject>::const_iterator es;


More information about the mythtv-dev mailing list