From 75fd5c16d1cf0bb6756d4dedd073fed2ef6ee325 Mon Sep 17 00:00:00 2001
From: Christoph Cullmann <christoph@cullmann.dev>
Date: Tue, 17 Jun 2025 18:42:57 +0200
Subject: [PATCH] use big resource variant, else we OOM on 32 bit machines

this has issues with LTO, we have a unit test that tells if stuff got lost in the DLL

fix the resource loading for static library building, uncovered by the new unit test

BUG: 487452
BUG: 499674
---
 src/lib/CMakeLists.txt     |  5 +--
 src/lib/breezeicons.cpp    |  9 +++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index e8c9e0ac9..600c8a8f4 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -24,8 +24,9 @@ if(BINARY_ICONS_RESOURCE)
     install(FILES ${RESOURCE_FILE_BINARY} DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/breeze)
 endif()
 
-# use normal resource adding, big resource variant has issue with LTO
-qt_add_resources(kbreezeicons_resource_SRCS
+# use big resource variant, else we OOM on 32 bit machines
+# this has issues with LTO, we have a unit test that tells if stuff got lost in the DLL
+qt_add_big_resources(kbreezeicons_resource_SRCS
     ${RESOURCE_FILE}
     OPTIONS --root /icons/breeze
 )
diff --git a/src/lib/breezeicons.cpp b/src/lib/breezeicons.cpp
index 36d1ca873..7657e789d 100644
--- a/src/lib/breezeicons.cpp
+++ b/src/lib/breezeicons.cpp
@@ -10,11 +10,20 @@
 
 #include <QIcon>
 
+static void resourceInit()
+{
+    // needs to be called outside of namespace
+    Q_INIT_RESOURCE(breeze_icons);
+}
+
 namespace BreezeIcons
 {
 
 void initIcons()
 {
+    // ensure the resource is there and loaded for static libs
+    resourceInit();
+
     // ensure we fallback to breeze, if no user fallback is set
     const QString fallbackTheme = QIcon::fallbackThemeName();
     if (fallbackTheme.isEmpty() || fallbackTheme == QLatin1String("hicolor")) {
-- 
GitLab

