summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextdocument_p.cpp
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-04 11:17:47 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-04 11:17:47 (GMT)
commitbe212bf108e71ba3b5b75802b1f4de6613ba315c (patch)
treec541ad12e8698f04e8fe386c2e1b94e8baca6c1b /src/gui/text/qtextdocument_p.cpp
parent67ae1b0dac175f48875507f3187ed49276a29ddf (diff)
parente6bb00250b321b149dd80259dc4f479088d5949b (diff)
downloadQt-be212bf108e71ba3b5b75802b1f4de6613ba315c.zip
Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.tar.gz
Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.tar.bz2
Merge commit 'origin/master'
Conflicts: src/corelib/global/qglobal.h src/corelib/kernel/qmetatype.cpp src/corelib/kernel/qobject.cpp src/corelib/thread/qthread_unix.cpp src/gui/graphicsview/qgraphicssceneevent.h src/gui/itemviews/qheaderview.h src/gui/kernel/qapplication_qws.cpp src/gui/kernel/qgesture.h src/gui/kernel/qgesturerecognizer.h src/gui/painting/qpaintengine_raster.cpp src/network/access/qhttpnetworkreply.cpp src/network/access/qnetworkcookie.h src/network/socket/qnativesocketengine_unix.cpp
Diffstat (limited to 'src/gui/text/qtextdocument_p.cpp')
-rw-r--r--src/gui/text/qtextdocument_p.cpp76
1 files changed, 41 insertions, 35 deletions
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index e66b07c..88afe4a 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -188,6 +188,7 @@ QTextDocumentPrivate::QTextDocumentPrivate()
docChangeOldLength(0),
docChangeLength(0),
framesDirty(true),
+ rtFrame(0),
initialBlockCharFormatIndex(-1) // set correctly later in init()
{
editBlock = 0;
@@ -218,7 +219,6 @@ QTextDocumentPrivate::QTextDocumentPrivate()
void QTextDocumentPrivate::init()
{
- rtFrame = 0;
framesDirty = false;
bool undoState = undoEnabled;
@@ -241,42 +241,48 @@ void QTextDocumentPrivate::clear()
}
QList<QTextCursorPrivate *>oldCursors = cursors;
- cursors.clear();
- changedCursors.clear();
-
- QMap<int, QTextObject *>::Iterator objectIt = objects.begin();
- while (objectIt != objects.end()) {
- if (*objectIt != rtFrame) {
- delete *objectIt;
- objectIt = objects.erase(objectIt);
- } else {
- ++objectIt;
+ QT_TRY{
+ cursors.clear();
+ changedCursors.clear();
+
+ QMap<int, QTextObject *>::Iterator objectIt = objects.begin();
+ while (objectIt != objects.end()) {
+ if (*objectIt != rtFrame) {
+ delete *objectIt;
+ objectIt = objects.erase(objectIt);
+ } else {
+ ++objectIt;
+ }
}
- }
- // also clear out the remaining root frame pointer
- // (we're going to delete the object further down)
- objects.clear();
+ // also clear out the remaining root frame pointer
+ // (we're going to delete the object further down)
+ objects.clear();
- title.clear();
- undoState = 0;
- truncateUndoStack();
- text = QString();
- unreachableCharacterCount = 0;
- modifiedState = 0;
- modified = false;
- formats = QTextFormatCollection();
- int len = fragments.length();
- fragments.clear();
- blocks.clear();
- cachedResources.clear();
- delete rtFrame;
- init();
- cursors = oldCursors;
- inContentsChange = true;
- q->contentsChange(0, len, 0);
- inContentsChange = false;
- if (lout)
- lout->documentChanged(0, len, 0);
+ title.clear();
+ undoState = 0;
+ truncateUndoStack();
+ text = QString();
+ unreachableCharacterCount = 0;
+ modifiedState = 0;
+ modified = false;
+ formats = QTextFormatCollection();
+ int len = fragments.length();
+ fragments.clear();
+ blocks.clear();
+ cachedResources.clear();
+ delete rtFrame;
+ rtFrame = 0;
+ init();
+ cursors = oldCursors;
+ inContentsChange = true;
+ q->contentsChange(0, len, 0);
+ inContentsChange = false;
+ if (lout)
+ lout->documentChanged(0, len, 0);
+ } QT_CATCH(...) {
+ cursors = oldCursors; // at least recover the cursors
+ QT_RETHROW;
+ }
}
QTextDocumentPrivate::~QTextDocumentPrivate()