Skip to content

Commit

Permalink
Make sure we delete RAOP device in the thread that started it.
Browse files Browse the repository at this point in the history
Fixes occasional crash at shutdown
  • Loading branch information
jyavenard committed Jun 18, 2013
1 parent 9b22dab commit e1773c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 8 additions & 5 deletions mythtv/libs/libmythtv/AirPlay/mythraopdevice.cpp
Expand Up @@ -55,6 +55,9 @@ bool MythRAOPDevice::Create(void)
QObject::connect(
gMythRAOPDeviceThread->qthread(), SIGNAL(started()),
gMythRAOPDevice, SLOT(Start()));
QObject::connect(
gMythRAOPDeviceThread->qthread(), SIGNAL(finished()),
gMythRAOPDevice, SLOT(Stop()));
gMythRAOPDeviceThread->start(QThread::LowestPriority);
}

Expand All @@ -67,9 +70,6 @@ void MythRAOPDevice::Cleanup(void)
{
LOG(VB_GENERAL, LOG_INFO, LOC + "Cleaning up.");

if (gMythRAOPDevice)
gMythRAOPDevice->Teardown();

QMutexLocker locker(gMythRAOPDeviceMutex);
if (gMythRAOPDeviceThread)
{
Expand All @@ -92,8 +92,6 @@ MythRAOPDevice::MythRAOPDevice()

MythRAOPDevice::~MythRAOPDevice()
{
Teardown();

delete m_lock;
m_lock = NULL;
}
Expand Down Expand Up @@ -149,6 +147,11 @@ void MythRAOPDevice::Start(void)
return;
}

void MythRAOPDevice::Stop(void)
{
Teardown();
}

bool MythRAOPDevice::RegisterForBonjour(void)
{
// announce service
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/AirPlay/mythraopdevice.h
Expand Up @@ -30,6 +30,7 @@ class MTV_PUBLIC MythRAOPDevice : public ServerPool

private slots:
void Start();
void Stop();
void newConnection(QTcpSocket *client);
void deleteClient();

Expand Down

0 comments on commit e1773c2

Please sign in to comment.