<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Thanks for all the help guys.<br>
<br>
It seems the problem (or at least 'a' problem) was when you are
set to an intro (or above) and you try to lookup ChapterMax or
VerseMax.<br>
I added a check to simply return 0 if this is called.<br>
<br>
Nic's code snippet doesn't throw any valgrind errors anymore.<br>
<br>
Hope this squashes this.<br>
<br>
Let me know,<br>
<br>
Troy<br>
<br>
<br>
<br>
On 03/21/2013 03:40 AM, Nic Carter wrote:<br>
</div>
<blockquote cite="mid:A5326727-0659-41CE-9096-574032B6D233@mac.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Ok, I have just looked into r2785 in PS.
<div><br>
</div>
<div>PS opened to the previous chapter/verse I had used in the
app, but when I tried to navigate to Genesis chapter 1 it
exploded the same as what has been reported.</div>
<div><br>
</div>
<div>The code I have is:</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space: pre; "> </span>sword::VerseKey *curKey
= (sword::VerseKey*)swModule->getKey();<br>
<span class="Apple-tab-span" style="white-space: pre; "> </span>curKey->setIntros(YES);<br>
<span class="Apple-tab-span" style="white-space: pre; "> </span>curKey->setText([chapter cStringUsingEncoding: NSUTF8StringEncoding]);<br>
<span class="Apple-tab-span" style="white-space: pre; "> </span>curKey->setVerse(0);<br>
<span class="Apple-tab-span" style="white-space: pre; "> </span><br>
<span class="Apple-tab-span" style="white-space: pre; "> </span>swModule->stripText();<br>
<br>
</div>
<div>and the setText call is basically being given "Genesis 1".
This code has worked since day 1 of PS.</div>
<div><br>
</div>
<div>The call to stripText() is where it explodes, and in my case,
it is thinking that it should be going to chapter 159607.</div>
<div><br>
</div>
<div>Seems r2785 introduces a fun bug somewhere?</div>
<div><br>
</div>
<div>Further testing reveals that it works fine bringing up Gen 2</div>
<div>works fine bringing up Matt 1 (possible corner case, given
it's the first book in the NT?)</div>
<div>works fine with Rev 1, Rev 22</div>
<div><br>
</div>
<div>However, then randomly, I decided to try Gen 1 again & it
worked!</div>
<div>So I force quit the app, launched again & it resumed it's
crashing on Gen 1, this time thinking it was trying chapter
160880... :/</div>
<div><br>
</div>
<div>Moving the setIntros(YES) line below setText() did not solve
the issue.</div>
<div>However, removing the setIntros() line and changing the other
line to setVerse(1) DID seem to solve the crashing issue for me.</div>
<div><br>
</div>
<div>So, it appears that when setIntros() is set to YES then the
r2785 changes causes a crash.</div>
<div><br>
</div>
<div>FYI, screenshot of the stack where it crashes is attached for
fun :)</div>
<div><br>
</div>
<div>Hope this helps? Gotta run off now, so I can't dig deeper
right now...</div>
<div><br>
</div>
<div><br>
</div>
<div>ybic</div>
<div><span class="Apple-tab-span" style="white-space: pre; "> </span>nic...
:)</div>
<div><br>
</div>
<div>// attachment removed as even tho it was only 10k, it failed
to get through without moderation :(</div>
<br>
<div>
<div>On 20/03/2013, at 1:26 AM, Greg Hellings <<a
moz-do-not-send="true" href="mailto:greg.hellings@gmail.com">greg.hellings@gmail.com</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div dir="ltr">I have toyed with changing this on the Xiphos
side, setting key.setIntros(1) before setting the key to 0:0
or 1:0 and rendering. The key that is used during rendering
appears to be a copy of the module's key, and it does not
appear to be preserving the value of the intros parameter.
It seems like this should be a multi-point fix.
<div>
<br>
</div>
<div>1) SWORD should not explode when intros == 0 and the
user tries to navigate to a Genesis {1,0}:0 destination.
My previous diff appears to handle that.</div>
<div>2) Xiphos should properly call setIntros(1) before
attempting to fetch 1:0 without the user's direct input
(e.g. when the user has selected to view headings &
intros). I have a diff in hand for this, but it does not
resolve the problem because...</div>
<div>3) SWORD should properly preserve the value of intros
when copying the key for use during rendering.<br>
<div><br>
</div>
<div style="">--Greg</div>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Mar 19, 2013 at 8:26 AM,
Greg Hellings <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:greg.hellings@gmail.com" target="_blank">greg.hellings@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">The following diff seems to solve the
problem. I don't know if it's the "correct" way to go
about it, but it appears to resolve the issue from
what I see in Xiphos. I have a feeling the "better"
way to do it is to have Xiphos set the intros == 1
before attempting to fetch intro material? My editor
appears to have botched the white space, so please
forgive that.
<div>
<br>
</div>
<div>
<div>diff --git a/src/keys/versekey.cpp
b/src/keys/versekey.cpp</div>
<div>index 20cccc5..0290fd7 100644</div>
<div>--- a/src/keys/versekey.cpp</div>
<div>+++ b/src/keys/versekey.cpp</div>
<div>@@ -1347,7 +1347,9 @@ void
VerseKey::normalize(bool autocheck)</div>
<div> }</div>
<div> if (verse <
(intros?0:1)) {</div>
<div> if (--chapter
< (intros?0:1)) {</div>
<div>- --book;</div>
<div>+ if (book > 1) {</div>
<div>+ --book;</div>
<div>+ }</div>
<div> chapter
+= (getChapterMax() + (intros?1:0));</div>
<div> }</div>
<div> verse +=
(getVerseMax() + (intros?1:0));</div>
</div>
</div>
<div class="HOEnZb">
<div class="h5">
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
On Mon, Mar 18, 2013 at 9:13 PM, Greg Hellings <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:greg.hellings@gmail.com"
target="_blank">greg.hellings@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0
0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">
<div>On Mon, Mar 18, 2013 at 5:07 PM,
Troy A. Griffitts <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:scribe@crosswire.org"
target="_blank">scribe@crosswire.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="margin:0 0 0
.8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div bgcolor="#FFFFFF"
text="#000000">
<div>Thanks Greg,<br>
<br>
Any idea where chapter 17474 is
coming from?<br>
<br>
I can add code to check max
before looking into the vector,
which I'd rather not because it
should be an unnecessary check
each time and will be a speed
hit, but even so, who ever is
asking for the maximum verse for
chapter 17474 is obviously doing
something wrong.<br>
<br>
</div>
</div>
</blockquote>
<div><br>
</div>
</div>
<div>I'm hardly competent with a C
debugger, but let's see what sense I
can make of this. Somewhere in
VerseKey::parseVerseList on line 944
(#5 in the stack trace) curKey has a
value of 17425 for chapter. The text
buffer reads "Genesis 1:0" and the
value of the chap variable is 1. </div>
<div><br>
</div>
<div>The value of 17,425 is being set on
line 1351 of versekey.cpp when a key
value of "Genesis 1:0" is being parsed
while intros == 0. This triggers the
condition</div>
<div><br>
</div>
<div>if (verse < (intros?0:1))</div>
<div><br>
</div>
<div>which causes the resulting block to
be executed. Xiphos believes that
headings have been enabled here, and
Xiphos has always considered
'Headings' and 'Introductions' to be
synonymous from my understanding. I
know there's been some discussion of
the Headings/Intro distinction here
lately, so I don't know if Xiphos is
now running afoul of changes you made
in this distinction due to prior bugs
in the implementation that unified
them or not?</div>
<div><br>
</div>
<div>I'm not sure if there's more I can
contribute here without a deeper
understanding of Xiphos' options and
SWORD's parsing.</div>
<span><font color="#888888">
<div><br>
</div>
<div>--Greg</div>
</font></span>
<div>
<div>
</div>
<blockquote class="gmail_quote"
style="margin:0 0 0
.8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div bgcolor="#FFFFFF"
text="#000000">
<div> I'll try to have a look
soon.<span><font color="#888888"><br>
<br>
Troy</font></span>
<div><br>
<br>
<br>
<br>
On 03/18/2013 05:12 PM, Greg
Hellings wrote:<br>
</div>
</div>
<div>
<blockquote type="cite">
<div dir="ltr">#1
0x00007ffff527724c in
sword::VersificationMgr::Book::getVerseMax
(this=0xa60028,
chapter=17424)
<div class="gmail_extra">
<div class="gmail_quote">
<div>
<div> at
/home/ghellings/Projects-old/sword/src/mgr/versificationmgr.cpp:241</div>
<div>#2
0x00007ffff525aebb
in
sword::VerseKey::getVerseMax
(this=0xdcc290)</div>
<div> at
/home/ghellings/Projects-old/sword/src/keys/versekey.cpp:1243</div>
<div>#3
0x00007ffff525b65b
in
sword::VerseKey::normalize
(this=0xdcc290,
autocheck=true)</div>
<div> at
/home/ghellings/Projects-old/sword/src/keys/versekey.cpp:1353</div>
<div>#4
0x00007ffff525bbe9
in
sword::VerseKey::setVerse
(this=0xdcc290,
iverse=0)</div>
<div> at
/home/ghellings/Projects-old/sword/src/keys/versekey.cpp:1523</div>
<div>#5
0x00007ffff52596b3
in
sword::VerseKey::parseVerseList
(this=0xeb7fa0,
buf=0xea5e1b "",
defaultKey=0x0,
expandRange=false, </div>
<div>
useChapterAsVerse=false)
at
/home/ghellings/Projects-old/sword/src/keys/versekey.cpp:944</div>
<div>#6
0x00007ffff52570d8
in
sword::VerseKey::parse
(this=0xeb7fa0,
checkAutoNormalize=true)</div>
<div> at
/home/ghellings/Projects-old/sword/src/keys/versekey.cpp:293</div>
<div>#7
0x00000000004922df
in
sword::VerseKey::setText
(this=0xeb7fa0,
ikey=0xd04b20
"Genesis 0:0")</div>
<div> at
/usr/local/include/sword/versekey.h:210</div>
<div>#8
0x0000000000492310
in
sword::VerseKey::operator=
(this=0xeb7fa0,
ikey=0xd04b20
"Genesis 0:0")</div>
<div> at
/usr/local/include/sword/versekey.h:475</div>
<div>#9
0x00007ffff52df98f
in
sword::OSISFootnotes::processText
(this=0xef4920,
text=...,
key=0xd14a00,
module=0xef9618)</div>
<div> at
/home/ghellings/Projects-old/sword/src/modules/filters/osisfootnotes.cpp:65</div>
<div>#10
0x00007ffff5296fec
in
sword::SWModule::filterBuffer
(this=0xef9618,
filters=0xef90b0,
buf=...,
key=0xd14a00)</div>
<div> at
/home/ghellings/Projects-old/sword/src/modules/swmodule.cpp:1352</div>
<div>#11
0x00007ffff5297aa1
in
sword::SWModule::optionFilter
(this=0xef9618,
buf=...,
key=0xd14a00)</div>
<div> at
/home/ghellings/Projects-old/sword/include/swmodule.h:622</div>
<div>#12
0x00007ffff5293ea7
in
sword::SWModule::renderText
(this=0xef9618,
buf=0x0, len=-1,
render=true)</div>
<div> at
/home/ghellings/Projects-old/sword/src/modules/swmodule.cpp:826</div>
<div>#13
0x000000000049219f
in
sword::SWModule::operator
char const*
(this=0xef9618) at
/usr/local/include/sword/swmodule.h:709</div>
<div>#14
0x000000000049e093
in
GTKChapDisp::getVerseBefore
(this=0xf0b420,
imodule=...) at
../src/main/display.cc:1130</div>
<div><br>
</div>
<div>When I drill all
the way down in, the
appear to try and
pull the verse max
for chapter 17424
when asked to render
Genesis 0:0.</div>
<div><br>
</div>
<div>--Greg</div>
<div><br>
</div>
</div>
<div> </div>
<blockquote
class="gmail_quote"
style="margin:0px 0px
0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr">
<div><span><font
face="arial,
helvetica,
sans-serif"><br>
</font></span></div>
<div><span><font
face="arial,
helvetica,
sans-serif"><font><span
style="font-size:12px;line-height:16px;white-space:pre-wrap"><br>
</span></font></font></span></div>
<div><span><font
face="arial,
helvetica,
sans-serif"><font><span
style="font-size:12px;line-height:16px;white-space:pre-wrap">This
segfault only
seems to
happen when I
enter Genesis
1 in the
navigation
panel and not
at any other
time. Those
with more gdb
savvy than I
can maybe
figure out
more of what
is going on.</span></font></font></span></div>
<span><font
color="#888888">
<div><span><font
face="arial,
helvetica,
sans-serif"><font><span
style="font-size:12px;line-height:16px;white-space:pre-wrap"><br>
</span></font></font></span></div>
<div><span><font
face="arial,
helvetica,
sans-serif"><font><span
style="font-size:12px;line-height:16px;white-space:pre-wrap">--Greg</span></font></font></span></div>
</font></span></div>
<div>
<div>
<div
class="gmail_extra"><br>
<br>
<div
class="gmail_quote">On
Mon, Mar 11,
2013 at 8:57
PM, Karl
Kleinpaste <span
dir="ltr"><<a
moz-do-not-send="true" href="mailto:karl@kleinpaste.org" target="_blank">karl@kleinpaste.org</a>></span>
wrote:<br>
<blockquote
class="gmail_quote"
style="margin:0px
0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I
see that your
new
showchapter.cpp
works. The
only
difference in
how<br>
that works
versus Xiphos
code is you
changed the
VerseKey init
slightly,<br>
so I made that
change:<br>
<br>
VerseKey *key
= (VerseKey
*)imodule.getKey();<br>
<br>
And yet Xiphos
still fails to
construct the
chapter. The
loop never<br>
executes once.
I don't know
what to make
of it. I will
have to look
at<br>
it some more.<br>
<div>
<div><br>
_______________________________________________<br>
sword-devel
mailing list:
<a
moz-do-not-send="true"
href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a><br>
<a
moz-do-not-send="true"
href="http://www.crosswire.org/mailman/listinfo/sword-devel"
target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions
to
unsubscribe/change
your settings
at above page<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
sword-devel mailing list: <a moz-do-not-send="true" href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a>
<a moz-do-not-send="true" href="http://www.crosswire.org/mailman/listinfo/sword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page</pre>
</blockquote>
<br>
</div>
</div>
<br>
_______________________________________________<br>
sword-devel mailing list: <a
moz-do-not-send="true"
href="mailto:sword-devel@crosswire.org"
target="_blank">sword-devel@crosswire.org</a><br>
<a moz-do-not-send="true"
href="http://www.crosswire.org/mailman/listinfo/sword-devel"
target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change
your settings at above page<br>
</blockquote>
</div>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
_______________________________________________<br>
sword-devel mailing list: <a moz-do-not-send="true"
href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a><br>
<a moz-do-not-send="true"
href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your settings at above page</blockquote>
</div>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org">sword-devel@crosswire.org</a>
<a class="moz-txt-link-freetext" href="http://www.crosswire.org/mailman/listinfo/sword-devel">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page</pre>
</blockquote>
<br>
</body>
</html>