Ticket #9602: 0001-Try-to-keep-from-another-apparent-race-condition.patch

File 0001-Try-to-keep-from-another-apparent-race-condition.patch, 1.7 KB (added by beirdo, 13 years ago)
  • mythtv/libs/libmythbase/mythsystem.cpp

    From 4933aa6314dd33b711cacb8380a9751674655161 Mon Sep 17 00:00:00 2001
    From: Gavin Hurlbut <ghurlbut@mythtv.org>
    Date: Sun, 20 Feb 2011 14:09:55 -0800
    Subject: [PATCH] Try to keep from another apparent race condition
    
    Not quite sure why the QMap is going crazy, but let's try reading the
    AutoCleanup flag before unlocking so we can mitigate the race some.  Also,
    in both myth_system() and in the signal handler, use deleteLater() so we don't
    try to double-delete, as that will just cause other messes.
    
    Fixes #9602
    ---
     mythtv/libs/libmythbase/mythsystem.cpp  |    2 +-
     mythtv/libs/libmythbase/system-unix.cpp |    6 ++++--
     2 files changed, 5 insertions(+), 3 deletions(-)
    
    diff --git a/mythtv/libs/libmythbase/mythsystem.cpp b/mythtv/libs/libmythbase/mythsystem.cpp
    index 557aa4d..c0f1d53 100644
    a b uint myth_system(const QString &command, uint flags, uint timeout) 
    368368    ms->Run(timeout);
    369369    uint result = ms->Wait(0);
    370370    if (!ms->GetSetting("RunInBackground"))
    371         delete ms;
     371        ms->deleteLater();
    372372
    373373    return result;
    374374}
  • mythtv/libs/libmythbase/system-unix.cpp

    diff --git a/mythtv/libs/libmythbase/system-unix.cpp b/mythtv/libs/libmythbase/system-unix.cpp
    index 3767af7..d96f405 100644
    a b void MythSystemSignalManager::run(void) 
    465465
    466466            ms->disconnect();
    467467
     468            bool cleanup = ms->m_parent->doAutoCleanup();
     469
    468470            ms->Unlock();
    469471
    470             if( ms->m_parent->doAutoCleanup() )
    471                 delete ms;
     472            if( cleanup )
     473                ms->deleteLater();
    472474        }
    473475    }
    474476}