----- Original Message ----- 
From: "Martin Simmons" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, August 20, 2004 4:39 AM
Subject: Re: [Lesstif-discuss] Error in XmList


> >>>>> On Thu, 19 Aug 2004 16:57:07 -0500, "Dave Williss"
<[EMAIL PROTECTED]> said:
>
>   Dave> There is an error in XmList...
>
>   Dave> Starting condition: You have a list with one item and it's
selected.
>   Dave> Call XmListAddItemUnselected() to add another item before it.
>   Dave> Then XmListDeletePos() to delete the old item.
>
>   Dave> Problem: When adding the new item, it does not adjust the
>   Dave> List_SelectedIndices, so the list still thinks item 1 (the first
>   Dave> one) is highlighted when actually it's item 2.
>
> Look like this could be related to bug # 916711
>
>
http://sourceforge.net/tracker/index.php?func=detail&aid=916711&group_id=8596&atid=108596
>

Could be related, but this one is more nasty.  When you add an item and then
delete the selected item, we're OK with ending up with nothing selected.
What's nasty here is that even though nothing is selected, when you call
XmListGetSelectedPos, it still says that there's one item selected and
returns a list of one random number (unitialized garbage from the malloc
that was never filled in - if built for debugging, I think it has the value
of 0xbaadf00d).  We then try to use this item to index into an array of
stuff and KA BOOM!

A solution to this specific problem is pretty simple.  In
XmListGetSelectedPos, we add selected items to the return list using j as an
array index.  When we're done, j is the real number of selected items and
that's what it should return for the count.
That would solve this problem but hide the real problem which is that
something isn't keeping track of the number of selected items correctly in
the first place.



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Lesstif-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/lesstif-discuss

Reply via email to