summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qlogging.cpp
diff options
context:
space:
mode:
authorAurélien Brooke <aurelien@bahiasoft.fr>2025-05-03 11:28:40 +0200
committerAurélien Brooke <aurelien@bahiasoft.fr>2025-05-06 08:19:16 +0200
commit8bbdeaef85ead900d394f14a0fc4a4e9792982d2 (patch)
tree692b7628027077db961b53b6ffc949ae162f5b25 /src/corelib/global/qlogging.cpp
parent7d9b930b6fbb56e9c4a848b54af2db6b58926440 (diff)
qlogging: replace heap buffer with stack in win_outputDebugString_helper
The stack should have room for the 64KB. We don't use std::array to avoid unecessary zero-initialization. Amends a049325cc708b483ed1aadc6589419f4d74b19f3. Change-Id: I0e2ce0a74914010e259ae832995823d382c9276c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qlogging.cpp')
-rw-r--r--src/corelib/global/qlogging.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 97c7e70e386..26d50af3a30 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1938,7 +1938,7 @@ static void win_outputDebugString_helper(const QString &message)
if (message.length() <= maxOutputStringLength) {
OutputDebugString(reinterpret_cast<const wchar_t *>(message.utf16()));
} else {
- wchar_t *messagePart = new wchar_t[maxOutputStringLength + 1];
+ wchar_t messagePart[maxOutputStringLength + 1];
for (qsizetype i = 0; i < message.length(); i += maxOutputStringLength) {
const qsizetype length = qMin(message.length() - i, maxOutputStringLength);
const qsizetype len = QStringView{message}.mid(i, length).toWCharArray(messagePart);
@@ -1946,7 +1946,6 @@ static void win_outputDebugString_helper(const QString &message)
messagePart[len] = 0;
OutputDebugString(messagePart);
}
- delete[] messagePart;
}
}