Prevent duplicate "finish" threading messages

As they don't get processed and may show up as a memory leak.
This commit is contained in:
Jon Siwek 2019-12-27 07:35:59 -08:00
parent 3742e5601c
commit 9e07b8a9f1
2 changed files with 4 additions and 1 deletions

View file

@ -176,6 +176,7 @@ MsgThread::MsgThread() : BasicThread(), queue_in(this, 0), queue_out(0, this)
cnt_sent_in = cnt_sent_out = 0;
main_finished = false;
child_finished = false;
child_sent_finish = false;
failed = false;
thread_mgr->AddMsgThread(this);
}
@ -185,9 +186,10 @@ extern int signal_val;
void MsgThread::OnSignalStop()
{
if ( main_finished || Killed() )
if ( main_finished || Killed() || child_sent_finish )
return;
child_sent_finish = true;
// Signal thread to terminate.
SendIn(new FinishMessage(this, network_time), true);
}