From 62684de1a0d3c400d6ecd3b06c8ffdcb49a1e90a Mon Sep 17 00:00:00 2001 From: jghali Date: Wed, 16 Jun 2010 19:56:30 +0000 Subject: [PATCH] #9180 : fix crash when selecting frame after modifying text in story editor git-svn-id: svn://scribus.info/Scribus/branches/Version135@15199 11d20701-8431-0410-a711-e3c959e3b870 --- Scribus/scribus/pageitem_textframe.cpp | 4 ++-- Scribus/scribus/storyeditor.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Scribus/scribus/pageitem_textframe.cpp b/Scribus/scribus/pageitem_textframe.cpp index 62c9ab5..e04b875 100644 --- a/Scribus/scribus/pageitem_textframe.cpp +++ b/Scribus/scribus/pageitem_textframe.cpp @@ -2364,7 +2364,7 @@ void PageItem_TextFrame::DrawObj_Item(ScPainter *p, QRectF cullingArea, double s bool previousWasObject(false); double selX = ls.x; ScText *hls = 0; - for (int as = ls.firstItem; as <= qMin(ls.lastItem, itemText.length()); ++as) + for (int as = ls.firstItem; as <= qMin(ls.lastItem, itemText.length() - 1); ++as) { bool selecteds = itemText.selected(as); hls = itemText.item(as); @@ -2424,7 +2424,7 @@ void PageItem_TextFrame::DrawObj_Item(ScPainter *p, QRectF cullingArea, double s QColor tmp; ScText *hl = 0; - for (int a = ls.firstItem; a <= qMin(ls.lastItem, itemText.length()); ++a) + for (int a = ls.firstItem; a <= qMin(ls.lastItem, itemText.length() - 1); ++a) { hl = itemText.item(a); const CharStyle& charStyle(itemText.charStyle(a)); diff --git a/Scribus/scribus/storyeditor.cpp b/Scribus/scribus/storyeditor.cpp index 4f10599..ad3f349 100644 --- a/Scribus/scribus/storyeditor.cpp +++ b/Scribus/scribus/storyeditor.cpp @@ -2868,6 +2868,10 @@ void StoryEditor::updateTextFrame() } #endif Editor->saveItemText(nextItem); + // #9180 : force relayout here, it appears that relayout is sometime disabled + // to speed up selection, but re layout() cannot be avoided here + nextItem->invalidateLayout(); + nextItem->layout(); #if 0 QList FrameItemsDel; FrameItemsDel.setAutoDelete(true); -- 1.6.6.1