From 0a13e0a3e830be2b2b2e5c2c6cf8cef25bd68bd8 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu 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 #endif -static QLoggingCategory category("kf.kio.widgets.kdirmodel", QtInfoMsg); +Q_LOGGING_CATEGORY(category, "kf.kio.widgets.kdirmodel", QtInfoMsg) class KDirModelNode; class KDirModelDirNode; -- GitLab