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) |
368 | 368 | ms->Run(timeout); |
369 | 369 | uint result = ms->Wait(0); |
370 | 370 | if (!ms->GetSetting("RunInBackground")) |
371 | | delete ms; |
| 371 | ms->deleteLater(); |
372 | 372 | |
373 | 373 | return result; |
374 | 374 | } |
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) |
465 | 465 | |
466 | 466 | ms->disconnect(); |
467 | 467 | |
| 468 | bool cleanup = ms->m_parent->doAutoCleanup(); |
| 469 | |
468 | 470 | ms->Unlock(); |
469 | 471 | |
470 | | if( ms->m_parent->doAutoCleanup() ) |
471 | | delete ms; |
| 472 | if( cleanup ) |
| 473 | ms->deleteLater(); |
472 | 474 | } |
473 | 475 | } |
474 | 476 | } |