Ticket #11072: 0001-lock-CC708Window-text.patch

File 0001-lock-CC708Window-text.patch, 2.1 KB (added by Jack Thomasson <jkt@…>, 7 years ago)
  • mythtv/libs/libmythtv/cc708reader.cpp

    From 98af219bfa82f3c33646db344bba73dd92e540b4 Mon Sep 17 00:00:00 2001
    From: Jack Thomasson <jkt@moonlitsw.com>
    Date: Thu, 6 Sep 2012 18:02:58 -0600
    Subject: [PATCH] lock CC708Window::text
    
    the race ended in tragedy when CC708Reader::DisplayWindows wiped out text
    underneath GetStrings
    ---
     mythtv/libs/libmythtv/cc708reader.cpp |    1 +
     mythtv/libs/libmythtv/cc708window.cpp |   12 +++++++-----
     2 files changed, 8 insertions(+), 5 deletions(-)
    
    diff --git a/mythtv/libs/libmythtv/cc708reader.cpp b/mythtv/libs/libmythtv/cc708reader.cpp
    index 2233a6d..49221cf 100644
    a b void CC708Reader::DisplayWindows(uint service_num, int window_map) 
    117117        if ((1 << i) & CC708DelayedDeletes[service_num & 63])
    118118        {
    119119            CC708Window &win = GetCCWin(service_num, i);
     120            QMutexLocker locker(&win.lock);
    120121
    121122            win.exists  = false;
    122123            win.changed = true;
  • mythtv/libs/libmythtv/cc708window.cpp

    diff --git a/mythtv/libs/libmythtv/cc708window.cpp b/mythtv/libs/libmythtv/cc708window.cpp
    index 5a3870c..f3b8c80 100644
    a b void CC708Window::Clear(void) 
    231231
    232232CC708Character &CC708Window::GetCCChar(void) const
    233233{
    234     QMutexLocker locker(&lock);
    235234    assert(exists);
    236235    assert(text);
    237236    assert(pen.row    < true_row_count);
    void CC708Window::AddChar(QChar ch) 
    338337        changed = true;
    339338        return;
    340339    }
     340    QMutexLocker locker(&lock);
    341341
    342342    if (ch.toAscii() == 0x08)
    343343    {
    344344        DecrPenLocation();
    345         GetCCChar().attr      = pen.attr;
    346         GetCCChar().character = QChar(' ');
     345        CC708Character& chr = GetCCChar();
     346        chr.attr      = pen.attr;
     347        chr.character = QChar(' ');
    347348        changed = true;
    348349        return;
    349350    }
    350351
    351     GetCCChar().attr      = pen.attr;
    352     GetCCChar().character = ch;
     352    CC708Character& chr = GetCCChar();
     353    chr.attr      = pen.attr;
     354    chr.character = ch;
    353355    int c = pen.column;
    354356    int r = pen.row;
    355357    IncrPenLocation();