[sword-devel] RenderText and static local buffer

Ben Morgan benpmorgan at gmail.com
Mon Sep 21 19:10:52 MST 2009


I was debugging a problem in the XUL BPBible where it was filling in a table
for a gospel harmony inside the render filter.
Thus, it was calling RenderText inside a RenderText (though on a different
module). It was ending up with the last verse in the table coming before the
table, which was a bit annoying.

Digging through the code, I finally discovered what the problem was.

In SWModule's RenderText, there is this:
 static SWBuf local;
 if (buf)
  local = buf;

 SWBuf &tmpbuf = (buf) ? local : getRawEntryBuf();

So what was happening was that in the middle of the render filter, it was
swapping new buffer contents in, thus ending up with what last came out at
the start to be added onto in the first level of render filter.

So there can only ever be one RenderText call where the buffer is supplied.
If a SWBuf could be passed in this would allow a work-around. Likewise, if
the local buf was on the module, rather than global, this would help.

 <http://www.apostlesbible.com/>God Bless,
Ben
-------------------------------------------------------------------------------------------
Multitudes, multitudes,
    in the valley of decision!
For the day of the LORD is near
    in the valley of decision.

Giôên 3:14 (ESV)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20090922/4f1d991e/attachment.html>


More information about the sword-devel mailing list