From ddebf6ee7a68d5ffb42aeaccdfdd83f6a0fe5083 Mon Sep 17 00:00:00 2001 From: Anthony Bilinski Date: Fri, 18 Feb 2022 11:39:34 -0800 Subject: [PATCH] fix(crash): Handle nightly tag name in update check We didn't use to have a nightly tag, so git describe would include the verison of the last release even for nightly or dev builds. Now that the nightly tag exists, which is required for github release craeation, it breaks out git describe parsing, and there's no way for us to tell if a user is behind the next release or not. Instead just don't check update status if the user isn't on a release tagged version. --- src/net/updatecheck.cpp | 15 ++++++++------- src/widget/form/settings/aboutform.cpp | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/net/updatecheck.cpp b/src/net/updatecheck.cpp index 47553cd0d..aec381406 100644 --- a/src/net/updatecheck.cpp +++ b/src/net/updatecheck.cpp @@ -102,6 +102,7 @@ bool isCurrentVersionStable() UpdateCheck::UpdateCheck(const Settings& settings) : settings(settings) { + qInfo() << "qTox is running version:" << GIT_DESCRIBE; updateTimer.start(1000 * 60 * 60 * 24 /* 1 day */); connect(&updateTimer, &QTimer::timeout, this, &UpdateCheck::checkForUpdate); connect(&manager, &QNetworkAccessManager::finished, this, &UpdateCheck::handleResponse); @@ -113,6 +114,13 @@ void UpdateCheck::checkForUpdate() // still run the timer to check periodically incase setting changes return; } + + if (isCurrentVersionStable() == false) { + qWarning() << "Currently running an untested/unstable version of qTox"; + emit versionIsUnstable(); + return; + } + manager.setProxy(settings.getProxy()); QNetworkRequest request{versionUrl}; manager.get(request); @@ -120,13 +128,6 @@ void UpdateCheck::checkForUpdate() void UpdateCheck::handleResponse(QNetworkReply* reply) { - qInfo() << "qTox is running version:" << GIT_DESCRIBE; - - if (isCurrentVersionStable() == false) { - qWarning() << "Currently running an untested/unstable version of qTox"; - emit versionIsUnstable(); - } - assert(reply != nullptr); if (reply == nullptr) { qWarning() << "Update check returned null reply, ignoring"; diff --git a/src/widget/form/settings/aboutform.cpp b/src/widget/form/settings/aboutform.cpp index fd6b3ffca..92aa9fcaf 100644 --- a/src/widget/form/settings/aboutform.cpp +++ b/src/widget/form/settings/aboutform.cpp @@ -197,6 +197,7 @@ void AboutForm::reloadTheme() void AboutForm::onUnstableVersion() { + bodyUI->updateStack->hide(); bodyUI->unstableVersion->setVisible(true); }