[libcalamares] Stop job threads before exit
- This solves a crash where the thread is destroyed while still running (e.g. cancelling during install). - The thread might not cooperate in being terminated, but then we have a bigger problem anyway (and Calamares will still crash on exit). FIXES #1164
This commit is contained in:
parent
e49beaea91
commit
61b78d8895
@ -44,7 +44,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual ~JobThread() override;
|
virtual ~JobThread() override;
|
||||||
|
|
||||||
void setJobs( const JobList& jobs )
|
void setJobs( const JobList& jobs )
|
||||||
{
|
{
|
||||||
m_jobs = jobs;
|
m_jobs = jobs;
|
||||||
@ -157,6 +157,14 @@ JobQueue::JobQueue( QObject* parent )
|
|||||||
|
|
||||||
JobQueue::~JobQueue()
|
JobQueue::~JobQueue()
|
||||||
{
|
{
|
||||||
|
if ( m_thread->isRunning() )
|
||||||
|
{
|
||||||
|
m_thread->terminate();
|
||||||
|
if ( !m_thread->wait(300) )
|
||||||
|
cError() << "Could not terminate job thread (expect a crash now).";
|
||||||
|
delete m_thread;
|
||||||
|
}
|
||||||
|
|
||||||
delete m_storage;
|
delete m_storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user