From 8e51bdd43f53307e0b3317f670e597511c483006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 22 Nov 2005 12:38:50 +0000 Subject: [PATCH] This works around a sporadic crashing bug - I didn't really fixed the bug, just its symptoms. I guess this piece of code could need some documentation... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15065 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/BTextView/StyleBuffer.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/BTextView/StyleBuffer.cpp b/src/kits/interface/BTextView/StyleBuffer.cpp index a66e80a3d3..2297260c7f 100644 --- a/src/kits/interface/BTextView/StyleBuffer.cpp +++ b/src/kits/interface/BTextView/StyleBuffer.cpp @@ -15,6 +15,8 @@ #include +#include + _BStyleRunDescBuffer_::_BStyleRunDescBuffer_() : _BTextViewSupportBuffer_(20) @@ -288,9 +290,15 @@ _BStyleBuffer_::SetStyleRange(int32 fromOffset, int32 toOffset, } runIndex++; - offset = runEnd; + if (offset == runEnd) { + // TODO: this hides a bug somewhere else in the code that + // should probably be fixed... + printf("offset == runEnd!\n"); + break; + } + offset = runEnd; } while (offset < toOffset); - + if (offset == toOffset && runIndex < fStyleRunDesc.ItemCount() && fStyleRunDesc[runIndex]->index == styleIndex) RemoveStyles(runIndex);