Skip to content

Commit 22a7ce9

Browse files
committed
fix segfault
1 parent b772eed commit 22a7ce9

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

xmrstak/misc/executor.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,21 +1008,28 @@ void executor::shutdown()
10081008
{
10091009
bQuit = true;
10101010
std::cout<<"Shutdown miner, this takes up to 15 sec ..."<<std::endl;
1011-
// notify all backend threads
1012-
for(auto& backend : *pvThreads)
1013-
backend->shutdown();
1011+
1012+
if(pvThreads != nullptr)
1013+
{
1014+
// notify all backend threads
1015+
for(auto& backend : *pvThreads)
1016+
backend->shutdown();
1017+
}
10141018

10151019
bool canClose = true;
10161020
size_t round = 0u;
10171021
do
10181022
{
10191023
canClose = true;
1020-
for(auto& backend : *pvThreads)
1024+
if(pvThreads != nullptr)
10211025
{
1022-
if(!backend->isShutdownFinished())
1026+
for(auto& backend : *pvThreads)
10231027
{
1024-
canClose = false;
1025-
break;
1028+
if(!backend->isShutdownFinished())
1029+
{
1030+
canClose = false;
1031+
break;
1032+
}
10261033
}
10271034
}
10281035

xmrstak/misc/executor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class executor
8282
thdq<ex_event> oEventQ;
8383

8484
xmrstak::telemetry* telem;
85-
std::vector<xmrstak::iBackend*>* pvThreads;
85+
std::vector<xmrstak::iBackend*>* pvThreads = nullptr;
8686

8787
size_t current_pool_id = invalid_pool_id;
8888
size_t last_usr_pool_id = invalid_pool_id;

0 commit comments

Comments
 (0)