SafeThread: Avoid use-after-free risk in thread shutdown (#1355)

Use shared_ptr to keep data alive until the thread has terminated.
This commit is contained in:
Peter Johnson
2018-10-05 16:32:43 -07:00
committed by GitHub
parent 36000ddb36
commit 18c8cce6a7
8 changed files with 103 additions and 68 deletions

View File

@@ -45,10 +45,7 @@ Telemetry::Telemetry() {}
Telemetry::~Telemetry() {}
void Telemetry::Start() {
auto thr = m_owner.GetThread();
if (!thr) m_owner.Start(new Thread);
}
void Telemetry::Start() { m_owner.Start(); }
void Telemetry::Stop() { m_owner.Stop(); }