[comp.windows.x.motif] XmList problem

uuciks@swbatl.sbc.com (Kristina Smith - UCI - 5-3793) (06/06/91)

Has anyone ever seen this behavior before?

(Please note that I am an X11 and Motif programming novice)
(I'm running Motif 1.1)

I create a selectionBoxDialog like this:
 
selectionBox = XmCreateSelectionDialog(parent,"selectionBox",args,argcnt);

I create an XmStringTable filled with data and use XtSetArgs to make it the
item list for the selection box like this:

XtSetArg(args[argcnt], XmNlistItems, (XmStringTable)items); argcnt++;
XtSetArg(args[argcnt], XmNlistItemCount, (int)itemcount); argcnt++;

One of the pushButtons has a callback tied to it that deletes the current list
and adds new items to the list somewhat like the following:

XtUnmanageChild(list);
XmListDeleteAllItems(list);
XmListAddItem(list,xmstring,0);
XtManageChild(list);

Then when I try to select an item from the new list it coredumps with a memory
fault (segmentation violation) (not all the time, though.  It's very sporadic) 

When I use a debugger on it, and do a trace, this is what shows up:
_DrawHighlight(0x1ac2a8,0x3,0x1,0x1,0x20000,0x3) + c4
_ListFocusIn(0x1ac2a8,0xf7ffe7e4,0x0,0x19ad78,0x25,0x26838) + b0
__XtTranslateEvent(0x1ac2a8,0x0,0xf7ffe7e4,0x630,0x174d74,0x19ad70) + 360
_DispatchEvent(0xf7ffe7e4,0x1ac2a8,0x200000,0x0,0xf7ffe588,0xf7ffe3f8) + 328


Does anyone know what is happening or why it might be happening?

I would appreciate any thoughts or experiences at all!  I'm on a tight
deadline, and I can't seem to get past this!

Thanks!
Kristina Smith
kms@strider.sbc.com
314-235-3793
Southwestern Bell Telephone

sdl@d74sun.lyra.mitre.org (Steven D. Litvinchouk) (06/09/91)

In article <1991Jun5.182759.23939@swbatl.sbc.com> uuciks@swbatl.sbc.com (Kristina Smith - UCI - 5-3793) writes:

> Has anyone ever seen this behavior before?
> I create a selectionBoxDialog like this:
> 
> selectionBox = XmCreateSelectionDialog(parent,"selectionBox",args,argcnt);
> 
> XtUnmanageChild(list);
> XmListDeleteAllItems(list);
> XmListAddItem(list,xmstring,0);
> XtManageChild(list);
> 

> Then when I try to select an item from the new list it coredumps
> with a memory fault (segmentation violation) (not all the time,
> though.  It's very sporadic)

> 
> When I use a debugger on it, and do a trace, this is what shows up:
> _DrawHighlight(0x1ac2a8,0x3,0x1,0x1,0x20000,0x3) + c4
> _ListFocusIn(0x1ac2a8,0xf7ffe7e4,0x0,0x19ad78,0x25,0x26838) + b0
> __XtTranslateEvent(0x1ac2a8,0x0,0xf7ffe7e4,0x630,0x174d74,0x19ad70) + 360
> _DispatchEvent(0xf7ffe7e4,0x1ac2a8,0x200000,0x0,0xf7ffe588,0xf7ffe3f8) + 328

We have encountered *exactly* the same problem.  There appear to be
not one, but two separate bugs in the Motif XmList code:

1.  Deleting all selected items from an unmanaged XmList can cause a
segmentation fault crash.  Workaround: instead of deleting all items,
and then adding items as you have it, instead *first* add the new
items (appended to the end of the list), and *then* delete the old
items--in this way you never delete all items, so no crash.

2.  In a scrolled list, deleting the first item (I don't remember if
it needs to be selected) if the first item has been scrolled so that
it isn't visible will also cause a crash.  Workaround:  scroll the
list so that an item is visible when it is deleted.


By the way, we've also been having *lots* of trouble with the Motif
clipboard.  Anyone else in the same boat?


--
Steven Litvintchouk
MITRE Corporation
Burlington Road
Bedford, MA  01730
(617)271-7753
ARPA:  sdl@mbunix.mitre.org
UUCP:  ...{att,decvax,genrad,necntc,ll-xn,philabs,utzoo}!linus!sdl
	"Where does he get those wonderful toys?"

carl@gemini.UUCP (carl) (06/14/91)

Hi out there. I have a problem with the List widget that perhaps someone
out there can help with: There are numerous _convenience_ functions
(OSF/Motif developers - please go to your nearest dictionary and look
that word up) for selected items. You can unselect some or all (how USEFUL)
but that apparently does nothing more than turn off the hilite. What good is
that? How come there isn't a function to DELETE the selected items from the
list. Now THAT would be useful. The problem that I am experiencing is even
after retrieving the selectedItems and selectedItemCount resources, I cannot
use the returned values as arguments to XmListDeleteItem(). Is this just a
bug in 1.1? 
Also, I have a list widget on a bulletin board, and I want to change its' 
x/y position via XtSetValues(). This also does not work. Is the documentation
wrong where it says that the position CAN be changed with SetValues?
Thanks for your help.
BTW, If Motif is any indication, imagine what an operation system produced 
by OSF will be like :-)!
carl.