Fix crash that can occur with very specific timing during quit

This commit is contained in:
GriffinR 2025-08-13 12:32:10 -04:00
parent f47fc02b82
commit 2fd52e0b32
2 changed files with 17 additions and 9 deletions

View File

@ -5,7 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project somewhat adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). The MAJOR version number is bumped when there are **"Breaking Changes"** in the pret projects. For more on this, see [the manual page on breaking changes](https://huderlem.github.io/porymap/manual/breaking-changes.html).
## [Unreleased]
Nothing, yet.
### Fixed
- Fix rare crash while quitting Porymap.
## [6.2.0] - 2025-08-08
### Added

View File

@ -104,14 +104,7 @@ bool removeLogStatusBar(QStatusBar *statusBar) {
return false;
}
void updateLogDisplays(const QString &message, LogType type) {
static const QMap<LogType, QPixmap> icons = {
{LogType::LOG_INFO, QPixmap(QStringLiteral(":/icons/information.ico"))},
{LogType::LOG_WARN, QPixmap(QStringLiteral(":/icons/warning.ico"))},
{LogType::LOG_ERROR, QPixmap(QStringLiteral(":/icons/error.ico"))},
};
bool startTimer = false;
void pruneLogDisplays() {
auto it = QMutableListIterator<Log::Display>(Log::displays);
while (it.hasNext()) {
auto display = it.next();
@ -120,6 +113,19 @@ void updateLogDisplays(const QString &message, LogType type) {
it.remove();
continue;
}
}
}
void updateLogDisplays(const QString &message, LogType type) {
static const QMap<LogType, QPixmap> icons = {
{LogType::LOG_INFO, QPixmap(QStringLiteral(":/icons/information.ico"))},
{LogType::LOG_WARN, QPixmap(QStringLiteral(":/icons/warning.ico"))},
{LogType::LOG_ERROR, QPixmap(QStringLiteral(":/icons/error.ico"))},
};
pruneLogDisplays();
bool startTimer = false;
for (const auto &display : Log::displays) {
// Update the display, but only if it accepts this message type.
if (display.acceptedTypes.contains(type)) {
display.icon->setPixmap(icons.value(type));
@ -134,6 +140,7 @@ void updateLogDisplays(const QString &message, LogType type) {
}
void clearLogDisplays() {
pruneLogDisplays();
for (const auto &display : Log::displays) {
display.icon->setPixmap(QPixmap());
display.message->setText(QString());