From 33c59be551014c656370e0459c6cb5094ae68f3f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 16 May 2017 10:04:03 +0200 Subject: doc: Add warning about QTextLayout::beginLayout() and clearLayout() If you keep around QTextLines referring to the previous contents of the layout, you can experience crashes when using these after the layout has been cleared. Since QTextLine is a value type, this is not very obvious in the API, so we should at least give a warning in the docs. Task-number: QTBUG-60804 Change-Id: I81b2b640eec5f62b0af1e878aadd9fa23654ec18 Reviewed-by: Konstantin Ritt Reviewed-by: Venugopal Shivashankar Reviewed-by: Simon Hausmann --- src/gui/text/qtextlayout.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gui/text/qtextlayout.cpp') diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 023a1b7f52..cc91c107f9 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -630,6 +630,9 @@ Qt::CursorMoveStyle QTextLayout::cursorMoveStyle() const /*! Begins the layout process. + \warning This will invalidate the layout, so all existing QTextLine objects + that refer to the previous contents should now be discarded. + \sa endLayout() */ void QTextLayout::beginLayout() @@ -673,6 +676,9 @@ void QTextLayout::endLayout() Clears the line information in the layout. After having called this function, lineCount() returns 0. + + \warning This will invalidate the layout, so all existing QTextLine objects + that refer to the previous contents should now be discarded. */ void QTextLayout::clearLayout() { -- cgit v1.2.3