summaryrefslogtreecommitdiff
blob: 8f589b796aa544b8de9340b4105eb8c8ef4da90f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 0a13e0a3e830be2b2b2e5c2c6cf8cef25bd68bd8 Mon Sep 17 00:00:00 2001
From: Tusooa Zhu <tusooa@vista.aero>
Date: Thu, 4 Feb 2021 08:36:26 -0500
Subject: [PATCH] Fix default codec being set to "US-ASCII" in KIO apps

From https://doc.qt.io/qt-5/qloggingcategory.html#Q_LOGGING_CATEGORY-1 :
"The implicitly-defined QLoggingCategory object is created on first use,
in a thread-safe manner."

The original way to explicitly define a static QLoggingCategory will lead
to a call to ucnv_getDefaultName() before QApplication constructor (where
setlocale() is called), thus making QTextCodec::codecForLocale() misbehave.
Here we replace the explicit definition with the Q_LOGGING_CATEGORY macro,
and thus avoid this problem.

BUG: 432406
---
 src/widgets/kdirmodel.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/widgets/kdirmodel.cpp b/src/widgets/kdirmodel.cpp
index a48ab462..aa049e3d 100644
--- a/src/widgets/kdirmodel.cpp
+++ b/src/widgets/kdirmodel.cpp
@@ -36,7 +36,7 @@
 #include <qt_windows.h>
 #endif
 
-static QLoggingCategory category("kf.kio.widgets.kdirmodel", QtInfoMsg);
+Q_LOGGING_CATEGORY(category, "kf.kio.widgets.kdirmodel", QtInfoMsg)
 
 class KDirModelNode;
 class KDirModelDirNode;
-- 
GitLab