Browse Source

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.
reviewable/pr6468/r7
Anthony Bilinski 4 years ago
parent
commit
ddebf6ee7a
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 15
      src/net/updatecheck.cpp
  2. 1
      src/widget/form/settings/aboutform.cpp

15
src/net/updatecheck.cpp

@ -102,6 +102,7 @@ bool isCurrentVersionStable() @@ -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() @@ -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() @@ -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";

1
src/widget/form/settings/aboutform.cpp

@ -197,6 +197,7 @@ void AboutForm::reloadTheme() @@ -197,6 +197,7 @@ void AboutForm::reloadTheme()
void AboutForm::onUnstableVersion()
{
bodyUI->updateStack->hide();
bodyUI->unstableVersion->setVisible(true);
}

Loading…
Cancel
Save