summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-01-21 20:36:17 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2023-01-21 20:45:32 +0100
commit4c34f4bfee284f0065f4b72c5a12649d664acf43 (patch)
tree322c667998d191a68d4272135849afc9180bf56c
parentTranslated using Weblate (Russian) (diff)
downloadnheko-4c34f4bfee284f0065f4b72c5a12649d664acf43.tar.xz
Work around multiple destructor calls after consteval construction in full expression
I have no idea, if this is our fault or not, but Jason traced it back to
the consteval on the {fmt} format string constructor.

Specifically when a consteval constructor call happens in the statement,
the destructor call is moved to the end of the block. Inside the switch
statement that means, the destructor is called multiple times, which
corrupts the use count and crashes Nheko because of a double free.

I am assuming this is a bug in clang, but this will need to be
investigated more.

fixes #1292
-rw-r--r--src/Logging.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Logging.cpp b/src/Logging.cpp

index c41d3f82..46df8399 100644 --- a/src/Logging.cpp +++ b/src/Logging.cpp
@@ -45,19 +45,19 @@ qmlMessageHandler(QtMsgType type, const QMessageLogContext &context, const QStri switch (type) { case QtDebugMsg: - nhlog::qml()->debug("{} ({}:{}, {})", localMsg, file, context.line, function); + qml_logger->debug("{} ({}:{}, {})", localMsg, file, context.line, function); break; case QtInfoMsg: - nhlog::qml()->info("{} ({}:{}, {})", localMsg, file, context.line, function); + qml_logger->info("{} ({}:{}, {})", localMsg, file, context.line, function); break; case QtWarningMsg: - nhlog::qml()->warn("{} ({}:{}, {})", localMsg, file, context.line, function); + qml_logger->warn("{} ({}:{}, {})", localMsg, file, context.line, function); break; case QtCriticalMsg: - nhlog::qml()->critical("{} ({}:{}, {})", localMsg, file, context.line, function); + qml_logger->critical("{} ({}:{}, {})", localMsg, file, context.line, function); break; case QtFatalMsg: - nhlog::qml()->critical("{} ({}:{}, {})", localMsg, file, context.line, function); + qml_logger->critical("{} ({}:{}, {})", localMsg, file, context.line, function); break; } }