aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/GpgFrontendUIInit.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-01-16 03:49:50 +0000
committersaturneric <[email protected]>2024-01-16 03:49:50 +0000
commit4994f4eaa1211d402b791660ad6221154a4c2405 (patch)
treec3f0cdc0008849de79c6bd8030c0c65c5d02f9f3 /src/ui/GpgFrontendUIInit.cpp
parentfix: slove a heap-use-after-free problem (diff)
downloadGpgFrontend-4994f4eaa1211d402b791660ad6221154a4c2405.tar.gz
GpgFrontend-4994f4eaa1211d402b791660ad6221154a4c2405.zip
fix: make task and threading system safer
Diffstat (limited to 'src/ui/GpgFrontendUIInit.cpp')
-rw-r--r--src/ui/GpgFrontendUIInit.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp
index f8901e1d..cf48e14d 100644
--- a/src/ui/GpgFrontendUIInit.cpp
+++ b/src/ui/GpgFrontendUIInit.cpp
@@ -28,10 +28,7 @@
#include "GpgFrontendUIInit.h"
-#include <qapplication.h>
-#include <qcoreapplication.h>
-
-#include <QtNetwork>
+#include <clocale>
#include "core/GpgConstants.h"
#include "core/function/CoreSignalStation.h"
@@ -235,10 +232,10 @@ void InitLocale() {
#ifndef WINDOWS
if (!lang.isEmpty()) {
- QString lc = lang + ".UTF-8";
+ auto lc = (lang + ".UTF-8").toUtf8();
// set LC_ALL
- auto* locale_name = setlocale(LC_ALL, lc.toUtf8());
+ auto* locale_name = std::setlocale(LC_ALL, lc.constData());
if (locale_name == nullptr) GF_UI_LOG_WARN("set LC_ALL failed, lc: {}", lc);
auto* language = getenv("LANGUAGE");
// set LANGUAGE
@@ -251,10 +248,10 @@ void InitLocale() {
}
#else
if (!lang.empty()) {
- QString lc = lang;
+ auto lc = lang.toUtf8();
// set LC_ALL
- auto* locale_name = setlocale(LC_ALL, lc.toUtf8());
+ auto* locale_name = setlocale(LC_ALL, lc);
if (locale_name == nullptr) GF_UI_LOG_WARN("set LC_ALL failed, lc: {}", lc);
auto language = getenv("LANGUAGE");