[mythtv-commits] Ticket #13571: Crash of backend on delete of program being recorded

MythTV noreply at mythtv.org
Mon Apr 6 19:59:43 UTC 2020


#13571: Crash of backend on delete of program being recorded
--------------------------------+-------------------------------
 Reporter:  Klaas de Waal       |          Owner:  Klaas de Waal
     Type:  Bug Report - Crash  |         Status:  assigned
 Priority:  minor               |      Milestone:  32.0
Component:  MythTV - General    |        Version:  Master Head
 Severity:  medium              |     Resolution:
 Keywords:                      |  Ticket locked:  0
--------------------------------+-------------------------------

Comment (by Klaas de Waal):

 Extensive testing of many different ways of coding the loop gives the
 following results:
 - loop with v31 code fails (as described before)
 - loop with v31 code BUT with constBegin and constEnd is OK
 - loop with v30 code fails
 - loop with v30 code BUT with const_interator, constBegin and constEnd is
 OK
 - loop with Java-style iterator is OK
 - loop with foreach over all keys is OK

 This shows that the problem is not caused by the v31 "for auto" loop
 coding style versus the v30 loop coding style. The underlying problem
 appears to be that the QMap is only re-entrant when using const. This is
 not a limitation that I can find the Qt documentation and it is likely a
 bug.

 If and how this should be reported back to Qt is another issue; for that
 it is probably needed to create a small standalone application that
 reproduces the problem.

 The proper solution looks to be to use constBegin and constEnd, so to
 change the code from this:
 {{{
     for (auto iter = m_encoderList->begin(); iter != m_encoderList->end();
 ++iter)
     {
         EncoderLink *elink = *iter;
 }}}

 to using constBegin and constEnd like this:

 {{{
     for (auto iter = m_encoderList->constBegin(); iter !=
 m_encoderList->constEnd(); ++iter)
     {
         EncoderLink *elink = *iter;
 }}}

 It is probably a good idea to change other loops of m_encoderList (and
 m_tvList etc) in the same way.

 A patch that contains all the testcases is attached for reference.

-- 
Ticket URL: <https://code.mythtv.org/trac/ticket/13571#comment:18>
MythTV <http://www.mythtv.org>
MythTV Media Center


More information about the mythtv-commits mailing list