testPing fix

This commit is contained in:
Nicolas Mailloux 2022-05-15 19:18:45 -04:00
parent 862ca379ef
commit fe88cc43e9
2 changed files with 10 additions and 1 deletions

View file

@ -794,12 +794,14 @@ namespace {
} }
return exitCode; return exitCode;
} }
/* For some reason, implementing a non-blocking version of this functions triggers a "terminate called without an active exception" error with a platform plugin compiled with a newer GCC 11 toolchain. The problem has been solved by transplanting this function into the related area which uses it.
else { else {
QString pingProg = "sh"; QString pingProg = "sh";
QStringList pingArgs; QStringList pingArgs;
pingArgs << "/mnt/onboard/.adds/inkbox/test_ping.sh"; pingArgs << "/mnt/onboard/.adds/inkbox/test_ping.sh";
pingProcess->startDetached(pingProg, pingArgs); pingProcess->startDetached(pingProg, pingArgs);
} }
*/
pingProcess->deleteLater(); pingProcess->deleteLater();
} }
bool getTestPingResults() { bool getTestPingResults() {

View file

@ -977,7 +977,14 @@ bool MainWindow::checkWifiState() {
void MainWindow::setWifiIcon() { void MainWindow::setWifiIcon() {
if(global::device::isWifiAble == true) { if(global::device::isWifiAble == true) {
if(checkWifiState() == true) { if(checkWifiState() == true) {
testPing(false); // testPing() the non-blocking way
QProcess * pingProcess = new QProcess();
QString pingProg = "sh";
QStringList pingArgs;
pingArgs << "/mnt/onboard/.adds/inkbox/test_ping.sh";
pingProcess->startDetached(pingProg, pingArgs);
pingProcess->deleteLater();
getTestPingResults(); getTestPingResults();
if(global::network::isConnected == true) { if(global::network::isConnected == true) {
if(lastWifiState != 3) { if(lastWifiState != 3) {