mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-04 00:36:36 +00:00
Fix persistence of deleted PCs. Fixes #82
This commit is contained in:
parent
af9fb0e091
commit
e20bf3fbd9
@ -422,10 +422,24 @@ public:
|
|||||||
m_ComputerManager(cm) {}
|
m_ComputerManager(cm) {}
|
||||||
|
|
||||||
void run()
|
void run()
|
||||||
|
{
|
||||||
|
QThread* pollingThread;
|
||||||
|
|
||||||
|
// Only do the minimum amount of work while holding the writer lock.
|
||||||
|
// We must release it before calling saveHosts().
|
||||||
{
|
{
|
||||||
QWriteLocker lock(&m_ComputerManager->m_Lock);
|
QWriteLocker lock(&m_ComputerManager->m_Lock);
|
||||||
|
|
||||||
QThread* pollingThread = m_ComputerManager->m_PollThreads[m_Computer->uuid];
|
pollingThread = m_ComputerManager->m_PollThreads[m_Computer->uuid];
|
||||||
|
|
||||||
|
m_ComputerManager->m_PollThreads.remove(m_Computer->uuid);
|
||||||
|
m_ComputerManager->m_KnownHosts.remove(m_Computer->uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Persist the new host list
|
||||||
|
m_ComputerManager->saveHosts();
|
||||||
|
|
||||||
|
// Delete the polling thread
|
||||||
if (pollingThread != nullptr) {
|
if (pollingThread != nullptr) {
|
||||||
pollingThread->requestInterruption();
|
pollingThread->requestInterruption();
|
||||||
|
|
||||||
@ -438,9 +452,8 @@ public:
|
|||||||
delete pollingThread;
|
delete pollingThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ComputerManager->m_PollThreads.remove(m_Computer->uuid);
|
// Finally, delete the computer itself. This must be done
|
||||||
m_ComputerManager->m_KnownHosts.remove(m_Computer->uuid);
|
// last because the polling thread might be using it.
|
||||||
|
|
||||||
delete m_Computer;
|
delete m_Computer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user