Ticket #13194: 20171222_ticket_#13194_MHEG_crash.patch

File 20171222_ticket_#13194_MHEG_crash.patch, 1.1 KB (added by Peter Bennett, 6 years ago)

Proposed fix

  • mythtv/libs/libmythfreemheg/Engine.cpp

    diff --git a/mythtv/libs/libmythfreemheg/Engine.cpp b/mythtv/libs/libmythfreemheg/Engine.cpp
    index 74c8d73..5b2bcb1 100644
    a b void MHEngine::TransitionToScene(const MHObjectRef &target) 
    488488
    489489    // Remove any events from the asynch event queue unless they derive from
    490490    // the application itself or a shared ingredient.
    491     MHAsynchEvent *pEvent;
    492     QQueue<MHAsynchEvent *>::iterator it = m_EventQueue.begin();
    493491
    494     while (it != m_EventQueue.end())
    495     {
    496         pEvent = *it;
     492    // This was causing crashes with leftover events being invalid.
     493    // Changed to clear all events at this point.
    497494
    498         if (!pEvent->pEventSource->IsShared())
    499         {
    500             delete pEvent;
    501             it = m_EventQueue.erase(it);
    502         }
    503         else
    504         {
    505             ++it;
    506         }
    507     }
     495    while (!m_EventQueue.isEmpty())
     496        delete m_EventQueue.dequeue();
    508497
    509498    // Can now actually delete the old scene.
    510499    if (pApp->m_pCurrentScene)