Permalink
Browse files

Make sure we delete AirPlay device in the thread that started it.

Fixes occasional crash at shutdown
  • Loading branch information...
jyavenard committed Jun 17, 2013
1 parent e1773c2 commit eb0d2430408fc5440f91b909df9e89a60d4abd45
@@ -357,6 +357,9 @@ bool MythAirplayServer::Create(void)
QObject::connect(
gMythAirplayServerThread->qthread(), SIGNAL(started()),
gMythAirplayServer, SLOT(Start()));
QObject::connect(
gMythAirplayServerThread->qthread(), SIGNAL(finished()),
gMythAirplayServer, SLOT(Stop()));
gMythAirplayServerThread->start(QThread::LowestPriority);
}
@@ -368,9 +371,6 @@ void MythAirplayServer::Cleanup(void)
{
LOG(VB_GENERAL, LOG_INFO, LOC + "Cleaning up.");
if (gMythAirplayServer)
gMythAirplayServer->Teardown();
QMutexLocker locker(gMythAirplayServerMutex);
if (gMythAirplayServerThread)
{
@@ -393,8 +393,6 @@ MythAirplayServer::MythAirplayServer()
MythAirplayServer::~MythAirplayServer()
{
Teardown();
delete m_lock;
m_lock = NULL;
}
@@ -482,6 +480,11 @@ void MythAirplayServer::Start(void)
return;
}
void MythAirplayServer::Stop(void)
{
Teardown();
}
void MythAirplayServer::newConnection(QTcpSocket *client)
{
QMutexLocker locker(m_lock);
@@ -66,6 +66,7 @@ class MTV_PUBLIC MythAirplayServer : public ServerPool
private slots:
void Start();
void Stop();
void newConnection(QTcpSocket *client);
void deleteConnection();
void read(void);

0 comments on commit eb0d243

Please sign in to comment.