Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
Qt Creator 2.3.0
-
None
-
fc5ef5ef6666e698a0e5b716d7eb860916aa4111
Description
I found a crash when input multi-byte for commit message.
See this commit:
From 2fc4e9001522808484666c98bda25987dfccc91b Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Fri, 20 Mar 2009 16:02:14 +0100
Subject: [PATCH] Fix wrapping of commit messagesRemove trimmedDescription(), always trim. Extract trimmed text using the
text cursor
Reviewed-by: Thorbjorn Lindeijer <thorbjorn.lindeijer@nokia.com>diff --git a/src/libs/utils/submiteditorwidget.cpp b/src/libs/utils/submiteditorwidget.cpp
index db559a2..687813c 100644
— a/src/libs/utils/submiteditorwidget.cpp
+++ b/src/libs/utils/submiteditorwidget.cpp
...
+
+// Extract the wrapped text from a text edit, which performs
+// the wrapping only optically.
+static QString wrappedText(const QTextEdit *e)
+{
+ const QChar newLine = QLatin1Char('\n');
+ QString rc;
+ QTextCursor cursor(e->document());
+ cursor.movePosition(QTextCursor::Start);
+ while (!cursor.atEnd())Unknown macro: {+ cursor.select(QTextCursor}+ return rc;
}QString SubmitEditorWidget::descriptionText() const
{
- QString rc = m_d->m_ui.description->toPlainText();
+ QString rc = trimMessageText(lineWrap() ? wrappedText(m_d->m_ui.description) : m_d->m_ui.description->toPlainText());
// append field entries
foreach(const SubmitEditorWidgetPrivate::FieldEntry &fe, m_d->m_fieldEntries) {
...
The crash happend in this statement:
cursor.movePosition(QTextCursor::Right);
Here is happend a ASSERT failed:
qt-everywhere-opensource-src-4.7.4\src\gui\text\qtextcursor_p.h (line: 78)
inline bool setPosition(int newPosition) {
Q_ASSERT(newPosition >= 0 && newPosition < priv->length());
bool moved = position != newPosition;
if (moved)Unknown macro: { position = newPosition; currentCharFormat = -1; }return moved;
}
I am from chinese, when when I input some chinese word (Multi-byte), then QTC crash.
I try to fix, but I found this perhaps Qt's bug.
Any comments?
Attachments
Issue Links
- relates to
-
QTCREATORBUG-5633 Qt Creator crash when I input Chinese character at git commit
- Closed