diff --git a/CHANGELOG.md b/CHANGELOG.md index f220c23c..ef5a3b65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/log.cpp b/src/log.cpp index 7eaaec26..1e06953e 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -104,14 +104,7 @@ bool removeLogStatusBar(QStatusBar *statusBar) { return false; } -void updateLogDisplays(const QString &message, LogType type) { - static const QMap 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::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 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());