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

List:       kwrite-devel
Subject:    Re: KDE/kdelibs/kate/buffer
From:       Christoph Cullmann <cullmann () absint ! de>
Date:       2010-04-09 20:09:05
Message-ID: 4BBF8961.3060908 () absint ! de
[Download RAW message or body]

Milian Wolff wrote:
> SVN commit 1112976 by mwolff:
>
> attempt to make blockForLine more reliable in a multi-threaded context
>
> still, the whole KateBuffer is inherently thread-unsafe and needs to be fixed properly
>
> CCBUG: 233823
> CCMAIL: kwrite-devel@kde.org
>   
Aeh, lol, please revert.
The buffer is not thread safe by design, like the old, this resort
doesn't help at all...
If kdevelop does this, you must fix your code to do this from the main
thread....

>  M  +9 -6      katetextbuffer.cpp  
>
>
> --- trunk/KDE/kdelibs/kate/buffer/katetextbuffer.cpp #1112975:1112976
> @@ -342,18 +342,21 @@
>    if (m_lastUsedBlock < 0 || m_lastUsedBlock >= m_blocks.size())
>      m_lastUsedBlock = 0;
>  
> +  int index = m_lastUsedBlock;
>    // search for right block
>    forever {
> -    int start = m_blocks[m_lastUsedBlock]->startLine();
> -    int lines = m_blocks[m_lastUsedBlock]->lines ();
> +    int start = m_blocks[index]->startLine();
> +    int lines = m_blocks[index]->lines ();
>  
> -    if (start <= line && line < (start + lines))
> -      return m_lastUsedBlock;
> +    if (start <= line && line < (start + lines)) {
> +      m_lastUsedBlock = index;
> +      return index;
> +    }
>  
>      if (line < start)
> -      m_lastUsedBlock--;
> +      index--;
>      else
> -      m_lastUsedBlock++;
> +      index++;
>    }
>  
>    // we should always find a block
>
>   


-- 
-------------------------------------- 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