mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-25 16:38:21 -04:00
[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
1 changed files with 9 additions and 1 deletions
|
@ -44,7 +44,7 @@ public:
|
|||
}
|
||||
|
||||
virtual ~JobThread() override;
|
||||
|
||||
|
||||
void setJobs( const JobList& jobs )
|
||||
{
|
||||
m_jobs = jobs;
|
||||
|
@ -157,6 +157,14 @@ JobQueue::JobQueue( QObject* parent )
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue