There is an error in XmList...

Starting condition: You have a list with one item and it's selected.
Call XmListAddItemUnselected() to add another item before it.
Then XmListDeletePos() to delete the old item.

Problem: When adding the new item, it does not adjust the
List_SelectedIndices, so the list still thinks item 1 (the first
one) is highlighted when actually it's item 2.

Then when XmListDeletePos() is called, it fails to find the
item being deleted (2) in SelectedIndices and so 
List_SelectedItemCount() never gets decremented

Later a call to XmlListGetSelectedPos thinks that the
List_SelectedItemCount == 1, and allocates (but doesn't 
clear) an array of that many.  It then ignores the 
List_SelectedIndices (they're wrong anyway) and goes 
through every item, looking for ones where selected is
true.  It finds none because it was deleted.  As a result, the
caller is told that there is one item selected and the index
of the selected item is random garbage.

 -- Dave Williss
------
Meddle not in the affairs of dragons, 
   for you are crunchy and taste good with catsup



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