Skip to content

Commit

Permalink
fixed System log crash when updated from another thread
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMontag committed Nov 15, 2024
1 parent 1344ce7 commit a58b547
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Version 1.19.2 *
Version 1.19.2
==================
- fixed usage of ISO-8859-1 for license file paths on Windows
- fixed unsorted files in project subfolder
- fixed closing Connect editor and Studio on saving connect file
- fixed Studio version information on macOS (Info.plist)
- fixed Welcome Page link to the [GAMS Forum](https://forum.gams.com/)
- fixed labels containing `Gams` instead of `GAMS`
- fixed System log crash when updated from another thread, e.g. via check for update
- improved plain text views for Connect and Solver Option editor by using a fixed font
- improved always enable the remind me later button of the check for update widget
- improved license file line separator and trailing whitespaces
Expand Down
1 change: 1 addition & 0 deletions ci/.gitlab-ci-4-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ deploy-github:
deploy-qt:
stage: deploy
tags: [linux]
needs: []
image:
name: $GAMS_CONTAINER_REGISTRY/qt-machines/deployer:latest
entrypoint: [""] # prevent startup.sh
Expand Down
1 change: 1 addition & 0 deletions ci/qt-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ if [[ "$CHANGES" == "" ]]; then
else
echo "update $README Qt everywhere package link"
git add $README
git status
git commit -m "pipeline updated $README Qt everywhere package link"
# prevent ci run via -o ci.skip
git push -o ci.skip
Expand Down
1 change: 1 addition & 0 deletions src/studio.pro
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ OTHER_FILES += \
../ci/cloudfront-deploy.sh \
../ci/github-deploy.sh \
../ci/codechecker.sh \
../ci/qt-deploy.sh \
../ci/skipfile.txt \
../ci/.gitlab-ci-0-gams.yml \
../ci/.gitlab-ci-1-build.yml \
Expand Down
23 changes: 10 additions & 13 deletions src/support/versioninfoloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void VersionInfoLoader::requestStudioInfo()
void VersionInfoLoader::distribDownloadFinished(QNetworkReply *reply)
{
auto process = [this, reply]{
QString error;
mErrorMessages.clear();
mDistribVersions.clear();
if (reply->error() == QNetworkReply::NoError) {
writeDataToLog("No error. Processing GAMS distrib YAML...");
Expand Down Expand Up @@ -163,25 +163,21 @@ void VersionInfoLoader::distribDownloadFinished(QNetworkReply *reply)
mDistribVersions[id] = date;
}
} catch (const YAML::ParserException& e) {
error = QString("Error while checking for updates : %1 : when loading : %2").arg(e.what(), DistribVersionFile);
writeDataToLog(error.toLatin1());
SysLogLocator::systemLog()->append(error, LogMsgType::Error);
mErrorMessages << QString("Error while checking for updates : %1 : when loading : %2")
.arg(e.what(), DistribVersionFile);
} catch (const std::string& e) {
error = QString("Error while checking for updates : %1 : when loading : %2")
mErrorMessages << QString("Error while checking for updates : %1 : when loading : %2")
.arg(QString::fromStdString(e), DistribVersionFile);
writeDataToLog(error.toLatin1());
SysLogLocator::systemLog()->append(error, LogMsgType::Error);
}
} else {
mErrorStrings << reply->errorString();
error = "Error while checking the GAMS distrib YAML: " + reply->errorString() + "\n";
writeDataToLog(error.toLatin1());
SysLogLocator::systemLog()->append("Error while checking the GAMS distrib YAML: " + reply->errorString(), LogMsgType::Error);
mErrorMessages << "Error while checking the GAMS distrib YAML: " + reply->errorString() + "\n";
}
reply->deleteLater();
if (error.isEmpty()) {
if (mErrorMessages.isEmpty()) {
emit continueProcessing();
} else {
writeDataToLog(mErrorMessages.join("\n").toLatin1());
writeDataToLog("Processing stopped due to previous error.");
}
};
Expand All @@ -201,9 +197,9 @@ void VersionInfoLoader::studioDownloadFinished(QNetworkReply *reply)
}
} else {
mErrorStrings << reply->errorString();
QString error = "Error while checking for GAMS Studio updates: " + reply->errorString() + "\n";
QString error = "Error while checking for GAMS Studio updates: " + reply->errorString();
mErrorMessages << error;
writeDataToLog(error.toLatin1());
SysLogLocator::systemLog()->append("Error while checking for GAMS Studio updates: "+ reply->errorString(), LogMsgType::Error);
}
reply->deleteLater();
emit finished();
Expand All @@ -226,6 +222,7 @@ void VersionInfoLoader::writeDataToLog(const QByteArray& data)
if (!logFile.open(QIODevice::Append | QIODevice::Text))
return;
logFile.write(data);
logFile.write("\n");
logFile.close();
}

Expand Down
1 change: 1 addition & 0 deletions src/support/versioninfoloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private slots:
int mRemoteStudioVersion = 0;
QString mRemoteStudioVersionString;
QStringList mErrorStrings;
QStringList mErrorMessages;
QMap<int, qint64> mDistribVersions;

QFuture<void> mResult;
Expand Down

0 comments on commit a58b547

Please sign in to comment.