Why does QChar( Qt::Key_Right ) now segfault?

106 views Asked by At

I am updating some old cold from a project known as QFakeVim, and it is taking keyboard inputs as integers, and then returning QChar's based on that integer. That is not particularly important other than the fact that this code used to be functional. I am not sure however what has changed since Qt6 in regards to QChar.

To replicate the bug, one merely needs this line of code:

QChar( Qt::key_Right );

which is calling this line of code:

constexpr QCHAR_MAYBE_IMPLICIT QChar(int rc) noexcept : QChar(uint(rc)) {}
// which calls:
constexpr QCHAR_MAYBE_IMPLICIT QChar(uint rc) noexcept : ucs((Q_ASSERT(rc <= 0xffff), char16_t(rc))) {}

Which is failing this:

Q_ASSERT(rc <= 0xffff)

Did something change in Qt6 regarding this? Why does it wish to Q_ASSERT here? Thanks.

0

There are 0 answers