Skip to content

Commit b24028d

Browse files
committed
ADThreadNetClient worker thread now queries action objects for shutdown request prior to calling action, as blocking actions release the main thread which then allows the action object to potentially go out of scope before the method is called by the worker leading to SEGVs
1 parent 9e85fad commit b24028d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/ad/ADNetClient.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,9 @@ void ADThreadNetClient::run(bool local){
428428
size_t nwork = getNwork();
429429
while(nwork > 0){
430430
ClientAction* work_item = getWorkItem();
431+
//Ask if shutdown is to be done *before* calling perform as blocking actions unlock the parent thread in perform which destroys the ClientAction object making the pointer invalid!
432+
shutdown = shutdown || work_item->shutdown_worker();
431433
work_item->perform(*client);
432-
shutdown = shutdown || work_item->shutdown_worker();
433434

434435
if(work_item->do_delete()) delete work_item;
435436
nwork = getNwork();

0 commit comments

Comments
 (0)