diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-10-12 03:07:23 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-10-12 03:07:23 +0200 |
commit | aad607f06dd9dbed1c0ff9fce5eccef9991d35d5 (patch) | |
tree | 362307bfcaaf0039d7825067741a3a87dbf096fd /src | |
parent | a694ae228ee1779b1c6ec3cae8f1178dea6d7a5d (diff) | |
parent | 486c51912393bf56cae0e45931fb135579a930d3 (diff) |
Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ia858f86e6a281f03bea17d0cc6bca300833ccda3
Diffstat (limited to 'src')
-rw-r--r-- | src/client/qwaylandwindow.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index ccf4f8dac..2704705e7 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -303,8 +303,10 @@ void QWaylandWindow::setWindowTitle(const QString &title) const QString formatted = formatWindowTitle(title, separator); const int libwaylandMaxBufferSize = 4096; - // Some parts of the buffer is used for metadata, so subtract 100 to be on the safe side - const int maxLength = libwaylandMaxBufferSize - 100; + // Some parts of the buffer is used for metadata, so subtract 100 to be on the safe side. + // Also, QString is in utf-16, which means that in the worst case each character will be + // three bytes when converted to utf-8 (which is what libwayland uses), so divide by three. + const int maxLength = libwaylandMaxBufferSize / 3 - 100; auto truncated = QStringRef(&formatted).left(maxLength); if (truncated.length() < formatted.length()) { |