From fdbc4734a473e2b40b16519d0e893aa9059ea7a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Sun, 11 Oct 2026 15:25:36 +0200 Subject: [PATCH 1/3] [Oracle] Fix Qt6 build and treat unknown memory as sufficient Use QRegularExpression behind the same Qt version guard as totalMemoryBytes() in availableMemoryBytes(), where a bare QRegExp broke every Qt6 Linux build. hasAtLeastGiB() now treats a 0 reading (unsupported platform or failed query) as unknown and skips the low-memory prompt instead of misreading it as low memory. --- .../libcockatrice/utility/system_memory_querier.cpp | 6 +++++- .../libcockatrice/utility/system_memory_querier.h | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libcockatrice_utility/libcockatrice/utility/system_memory_querier.cpp b/libcockatrice_utility/libcockatrice/utility/system_memory_querier.cpp index 46c24f69c..b4553f8d2 100644 --- a/libcockatrice_utility/libcockatrice/utility/system_memory_querier.cpp +++ b/libcockatrice_utility/libcockatrice/utility/system_memory_querier.cpp @@ -84,7 +84,11 @@ qulonglong SystemMemoryQuerier::availableMemoryBytes() while (!in.atEnd()) { QString line = in.readLine(); if (line.startsWith("MemAvailable:")) { - QStringList parts = line.split(QRegExp("\\s+"), Qt::SkipEmptyParts); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QStringList parts = line.split(QRegExp("\\s+"), QString::SkipEmptyParts); +#else + QStringList parts = line.split(QRegularExpression("\\s+"), Qt::SkipEmptyParts); +#endif if (parts.size() >= 2) return parts[1].toULongLong() * 1024; } diff --git a/libcockatrice_utility/libcockatrice/utility/system_memory_querier.h b/libcockatrice_utility/libcockatrice/utility/system_memory_querier.h index 44fd9f6f9..8a15fecdd 100644 --- a/libcockatrice_utility/libcockatrice/utility/system_memory_querier.h +++ b/libcockatrice_utility/libcockatrice/utility/system_memory_querier.h @@ -11,8 +11,14 @@ public: static bool hasAtLeastGiB(int gib) { + const qulonglong total = totalMemoryBytes(); + // 0 means the amount could not be determined (unsupported platform or failed query). + // Treat it as unknown and skip the check instead of misreading it as low memory. + if (total == 0) { + return true; + } const qulonglong GiB = 1024ull * 1024ull * 1024ull; - return totalMemoryBytes() >= (qulonglong)gib * GiB; + return total >= (qulonglong)gib * GiB; } }; From 7a4cfa56853d8bdb8ebf9a0c6019ea1a90da6a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Sun, 11 Oct 2026 15:25:36 +0200 Subject: [PATCH 2/3] [Build] Fix toolchain rot: const PlayerReference comparison, static writeMetadata --- libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp | 2 +- .../network/server/remote/server_player_reference.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp index cea759428..30b7ba314 100644 --- a/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp +++ b/libcockatrice_deck_list/libcockatrice/deck_list/deck_list.cpp @@ -166,7 +166,7 @@ bool DeckList::readElement(QXmlStreamReader *xml) return true; } -void writeMetadata(QXmlStreamWriter *xml, const DeckList::Metadata &metadata) +static void writeMetadata(QXmlStreamWriter *xml, const DeckList::Metadata &metadata) { xml->writeTextElement("lastLoadedTimestamp", metadata.lastLoadedTimestamp); xml->writeTextElement("deckname", metadata.name); diff --git a/libcockatrice_network/libcockatrice/network/server/remote/server_player_reference.h b/libcockatrice_network/libcockatrice/network/server/remote/server_player_reference.h index 07b2d3d2b..b478a4244 100644 --- a/libcockatrice_network/libcockatrice/network/server/remote/server_player_reference.h +++ b/libcockatrice_network/libcockatrice/network/server/remote/server_player_reference.h @@ -24,7 +24,7 @@ public: { return playerId; } - bool operator==(const PlayerReference &other) + bool operator==(const PlayerReference &other) const { return ((roomId == other.roomId) && (gameId == other.gameId) && (playerId == other.playerId)); } From 94c5a7d43fb7a194636c1fc1d32dff7e0c809c59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Sun, 11 Oct 2026 17:51:52 +0200 Subject: [PATCH 3/3] [Oracle] Skip low-memory prompt in background mode, guard with HAS_LZMA --- oracle/src/pages.cpp | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/oracle/src/pages.cpp b/oracle/src/pages.cpp index 6110fb58b..0b500a29a 100644 --- a/oracle/src/pages.cpp +++ b/oracle/src/pages.cpp @@ -188,21 +188,30 @@ void LoadSetsPage::initializePage() urlLineEdit->setText(wizard()->settings->value("allsetsurl", ALLSETS_URL).toString()); // Memory check because Oracle parsing fails on systems with less than 4GiB for MTGJsons allPrintings.json + // The fallback URL is xz-compressed, so only offer it in builds that can read it. + // During background (automatic) updates there is no user to answer, so switch silently. +#ifdef HAS_LZMA if (!SystemMemoryQuerier::hasAtLeastGiB(4) && urlLineEdit->text() == ALLSETS_URL) { - // Ask user whether to switch URL - QMessageBox msgBox( - QMessageBox::Question, tr("Low Memory Detected"), - tr("Your system has less than 4 GiB of memory.\n" - "Using the default AllPrintings URL may cause high memory usage and is known to fail as a result.\n\n" - "Would you like to switch to the direct-download pre-parsed URL instead? (Updated daily)"), - QMessageBox::Yes | QMessageBox::No, this); - - msgBox.setDefaultButton(QMessageBox::Yes); - - if (msgBox.exec() == QMessageBox::Yes) { + if (wizard()->backgroundMode) { urlLineEdit->setText(MTGXML_URL); + } else { + // Ask user whether to switch URL + QMessageBox msgBox( + QMessageBox::Question, tr("Low Memory Detected"), + tr("Your system has less than 4 GiB of memory.\n" + "Using the default AllPrintings URL may cause high memory usage and is known to fail as a " + "result.\n\n" + "Would you like to switch to the direct-download pre-parsed URL instead? (Updated daily)"), + QMessageBox::Yes | QMessageBox::No, this); + + msgBox.setDefaultButton(QMessageBox::Yes); + + if (msgBox.exec() == QMessageBox::Yes) { + urlLineEdit->setText(MTGXML_URL); + } } } +#endif progressLabel->hide(); progressBar->hide();