Re: hanging in textblock

"Sebastian Geerken" <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
I was not able to reproduce this bug, but ...

On Thu, Jan 03, corvid wrote:
> http://graphicssoft.about.com/od/aboutgraphics/a/bitmapvector.htm
> 
> #0  0x080929ad in dw::Textblock::findParagraphOfWord (this=0x82268b0, 
>     wordIndex=81) at textblock.cc:1228

Does it really hang here? If you apply the first patch, what is the
result (last couple of printed lines)?

OTOH, I've found a similar problem in the floats tree, which may occur
(with other symptoms) here. Does applying the second patch solve the
problem?

Sebastian

_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
patch1.diff (text/x-diff, 1.3 KB)
diff -r 88ac1e8678aa dw/textblock.cc
--- a/dw/textblock.cc	Thu Jan 03 07:47:25 2013 +0000
+++ b/dw/textblock.cc	Thu Jan 03 21:33:59 2013 +0100
@@ -1213,21 +1213,29 @@
  */
 int Textblock::findParagraphOfWord (int wordIndex)
 {
+   printf ("findParagraphOfWord (%d), in %d paragraphs ...\n",
+           wordIndex, paragraphs->size ());
+
    int high = paragraphs->size () - 1, index, low = 0;
 
    if (wordIndex < 0 || wordIndex >= words->size () ||
        // It may be that the paragraphs list is incomplete. But look
        // also at fillParagraphs, where this method is called.
        (paragraphs->size () > 0 &&
-        wordIndex > paragraphs->getLastRef()->lastWord))
+        wordIndex > paragraphs->getLastRef()->lastWord)) {
+      printf ("... --> not found\n");
       return -1;
+   }
 
    while (true) {
       index = (low + high) / 2;
       if (wordIndex >= paragraphs->getRef(index)->firstWord) {
-         if (wordIndex <= paragraphs->getRef(index)->lastWord)
+         if (wordIndex <= paragraphs->getRef(index)->lastWord) {
+            printf ("... --> %d (%d ... %d)\n",
+                    index, paragraphs->getRef(index)->firstWord,
+                    paragraphs->getRef(index)->lastWord);
             return index;
-         else
+         } else
             low = index + 1;
       } else
          high = index - 1;
patch2.diff (text/x-diff, 553 B)
diff -r 88ac1e8678aa dw/textblock.cc
--- a/dw/textblock.cc	Thu Jan 03 07:47:25 2013 +0000
+++ b/dw/textblock.cc	Thu Jan 03 21:37:24 2013 +0100
@@ -465,6 +465,12 @@
    }
 
    PRINTF ("       ... => %d\n", wrapRefLine);
+
+   // It seems that sometimes the lines structure is changed, so that
+   // wrapRefLines may refers to a line which does not exist
+   // anymore. Should be examined again. Until then, setting
+   // wrapRefLines to the same value is a workaround.
+   markExtremesChange (ref);
 }
 
 void Textblock::markExtremesChange (int ref)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.