Skip to content

Commit

Permalink
Thread cleanup on PACP permission error
Browse files Browse the repository at this point in the history
If the user didn't have permission for raw ethernet access (or other PCAP related error), the application would crash after displaying the error message box.
  • Loading branch information
marcusbirkin committed Jan 28, 2020
1 parent 6f1ae83 commit 5b4b2a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pcapplayback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ void PcapPlayback::openThread()
connect(sender, SIGNAL(sendingFinished()), this, SLOT(playbackFinished()));
connect(sender, SIGNAL(sendingClosed()), this, SLOT(playbackClosed()));
connect(sender, SIGNAL(error(QString)), this, SLOT(error(QString)));
connect(sender, SIGNAL(finished()), sender, SLOT(deleteLater()));
connect(sender, &QThread::finished, [this]() {
sender->deleteLater();
sender = Q_NULLPTR; });
connect(sender, SIGNAL(finished()), this, SLOT(playbackThreadClosed()));
ui->progressBar->reset();
sender->start();
Expand All @@ -47,7 +49,6 @@ void PcapPlayback::closeThread()
return;

sender->quit();
sender->deleteLater();
sender = Q_NULLPTR;
}

Expand Down
2 changes: 2 additions & 0 deletions src/pcapplaybacksender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ void pcapplaybacksender::run()
QThread::msleep(100);
}
}

exec();
}

void pcapplaybacksender::quit()
Expand Down

0 comments on commit 5b4b2a3

Please sign in to comment.