tread_pool: create it on the heap, because creating it static generate a DTOR issue on mingw.
When built with mingw, the tread_pool DTOR is probably called too late, and treads are not cleaned correctly, and the application hangs on exit.
This commit is contained in:
parent
7036c30384
commit
d90a2cc6b5
|
@ -397,8 +397,6 @@ bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit )
|
|||
}
|
||||
#endif
|
||||
|
||||
GetKiCadThreadPool();
|
||||
|
||||
// Init KiCad environment
|
||||
// the environment variable KICAD (if exists) gives the kicad path:
|
||||
// something like set KICAD=d:\kicad
|
||||
|
|
|
@ -24,10 +24,14 @@
|
|||
|
||||
#include <thread_pool.h>
|
||||
|
||||
// Under mingw, there is a problem with the destructor when creating a static instance
|
||||
// of a thread_pool: probably the DTOR is called too late, and the application hangs.
|
||||
// so we create it on the heap.
|
||||
static thread_pool* tp = nullptr;
|
||||
|
||||
thread_pool& GetKiCadThreadPool()
|
||||
{
|
||||
static thread_pool tp;
|
||||
return tp;
|
||||
}
|
||||
if( !tp ) tp = new thread_pool;
|
||||
|
||||
return *tp;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue