[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/calligra/2.6] libs/kotext: Fix crash due to acessing textrangemanager on the toc document
From:       C. Boemann <cbo () boemann ! dk>
Date:       2012-12-15 1:19:51
Message-ID: 20121215011951.0A09AA6091 () git ! kde ! org
[Download RAW message or body]

Git commit cdd7233f7d7e91fce69e2341ce39bdf9dae6dcf5 by C. Boemann.
Committed on 15/12/2012 at 01:57.
Pushed by boemann into branch 'calligra/2.6'.

Fix crash due to acessing textrangemanager on the toc document which was never set

solution is to just make sure we set a dummy one

M  +3    -0    libs/kotext/KoTextEditor.cpp
M  +1    -0    libs/kotext/opendocument/KoTextLoader.cpp

http://commits.kde.org/calligra/cdd7233f7d7e91fce69e2341ce39bdf9dae6dcf5

diff --git a/libs/kotext/KoTextEditor.cpp b/libs/kotext/KoTextEditor.cpp
index 7b00069..643fbc6 100644
--- a/libs/kotext/KoTextEditor.cpp
+++ b/libs/kotext/KoTextEditor.cpp
@@ -1302,6 +1302,9 @@ void \
                KoTextEditor::insertTableOfContents(KoTableOfContentsGeneratorInfo \
                *info)
     tocFormat.setProperty(KoParagraphStyle::TableOfContentsData, \
                QVariant::fromValue<KoTableOfContentsGeneratorInfo *>(newToCInfo) );
     tocFormat.setProperty(KoParagraphStyle::GeneratedDocument, \
QVariant::fromValue<QTextDocument*>(tocDocument));  
+    //make sure we set up the textrangemanager on the subdocument as well
+    KoTextDocument(tocDocument).setTextRangeManager(KoTextDocument(new \
KoTextRangeManager); +
     KoChangeTracker *changeTracker = KoTextDocument(d->document).changeTracker();
     if (changeTracker && changeTracker->recordChanges()) {
         QTextCharFormat charFormat = d->caret.charFormat();
diff --git a/libs/kotext/opendocument/KoTextLoader.cpp \
b/libs/kotext/opendocument/KoTextLoader.cpp index 5e29e48..1e97ac0 100644
--- a/libs/kotext/opendocument/KoTextLoader.cpp
+++ b/libs/kotext/opendocument/KoTextLoader.cpp
@@ -2611,6 +2611,7 @@ void KoTextLoader::loadTableOfContents(const KoXmlElement \
                &element, QTextCursor
     // to store the contents we use an extrafor "meta-information" about the TOC we \
use this class  QTextDocument *tocDocument = new QTextDocument();
     KoTextDocument(tocDocument).setStyleManager(d->styleManager);
+    KoTextDocument(tocDocument).setTextRangeManager(new KoTextRangeManager);
 
     info->m_name = element.attribute("name");
     info->m_styleName = element.attribute("style-name");


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic