[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: Re: TextBuffer is not thread safe - KateDocument->text() neither
From: Christoph Cullmann <cullmann () absint ! de>
Date: 2010-04-09 20:31:55
Message-ID: 4BBF8EBB.3050002 () absint ! de
[Download RAW message or body]
Milian Wolff wrote:
> Milian Wolff, 09.04.2010:
>
>> Hey all, esp. Cullmann:
>>
>> I found an easy way to trigger the assert from
>> https://bugs.kde.org/show_bug.cgi?id=233823 .
>>
>> I added debug output and it crashes really strangely, e.g. asserts and than
>> continues to output my debug output.... You know why, right :)
>>
>> The text buffer is simply not threadsafe, I mean look at it... I bet this
>> is the issue :-X
>>
>> Did you decide to do this on purpose to crash KDevelop, meaning: Was it
>> never intended to make KateDocument threadsafe?
>>
>> Bye, a very sad Milian
>>
>
> Here this shows perfectly the problem:
>
> TextBuffer::line( 12 ) index: 2 block: 512 768
> TextBuffer::line( 4199 ) index: 16 block: 4096 4352
> in: 12 corrected: -500 512 256
> in: 4199 corrected: 103 4096 256
>
> Essentially the blockForLine is not threadsafe, it gets called twice here and
> the m_lastUsedBlock is set in the middle, jerking things up...
>
Aehm, really, this was not done to break kdevelop, but neither the
current nor the old buffer were ever designed to be thread safe.
I mean, if you design a lock-free thread-safe buffer, I will be happy,
but I see not way. You have signals, you
have the smartpointer to the textlines, everything is just inherently
broken for threads.
There is no way to fix that, really.
Even with a big mutex, stuff won'T work, you would need to hold it for
all places still having references to text lines....
Greetings
Christoph
--
-------------------------------------- Christoph Cullmann ---------
AbsInt Angewandte Informatik GmbH Email: cullmann@AbsInt.com
Science Park 1 Tel: +49-681-38360-22
66123 Saarbrücken Fax: +49-681-38360-20
GERMANY WWW: http://www.AbsInt.com
--------------------------------------------------------------------
Geschäftsführung: Dr.-Ing. Christian Ferdinand
Eingetragen im Handelsregister des Amtsgerichts Saarbrücken, HRB 11234
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic