Commit fd17a804 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Disable the use of QStringBuilder for operator+

Automatic usage of QStringBuilder for string concatenation is just too
dangerous because lambdas returning the result of concatenating string
temporaries will cause crashes unless one explicitly forces the return
type to QString. I've hit this problem now for the second time and who
knows how many problematic lambdas remain undetected.
parent 24df800d
Pipeline #119097 passed with stage
in 1 minute and 42 seconds
......@@ -177,6 +177,18 @@ endif()
add_definitions(-DQT_NO_EMIT)
remove_definitions(-DQT_NO_FOREACH)
# Disable the use of QStringBuilder for operator+ to prevent crashes when
# returning the result of concatenating string temporaries in lambdas. We do
# this for example in some std::transform expressions.
# This is a known issue: https://bugreports.qt.io/browse/QTBUG-47066
# Alternatively, one would always have to remember to force the lambdas to
# return a QString instead of QStringBuilder, but that's just too easy to
# forget and, unfortunately, the compiler doesn't issue a warning if one forgets
# this. So, it's just too dangerous.
# One can still use QStringBuilder explicitly with the operator% if necessary.
remove_definitions(-DQT_USE_FAST_OPERATOR_PLUS)
remove_definitions(-DQT_USE_QSTRINGBUILDER)
kde_enable_exceptions()
option(USE_UNITY_CMAKE_SUPPORT "Use UNITY cmake support (speedup compile time)" OFF)
......
......@@ -50,6 +50,7 @@
#include <QMenu>
#include <QPushButton>
#include <QSpacerItem>
#include <QStringBuilder>
#include <QToolButton>
#include <QTreeWidget>
......@@ -165,10 +166,10 @@ private:
hboxLayout_1->addWidget(trustChainDetailsBtn);
genRevokeBtn = new QPushButton(i18n("Generate revocation certificate"), parent);
genRevokeBtn->setToolTip(u"<html>" +
genRevokeBtn->setToolTip(u"<html>" %
i18n("A revocation certificate is a file that serves as a \"kill switch\" to publicly "
"declare that a key shall not anymore be used. It is not possible "
"to retract such a revocation certificate once it has been published.") +
"to retract such a revocation certificate once it has been published.") %
u"</html>");
hboxLayout_1->addWidget(genRevokeBtn);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment