[comp.windows.open-look] scrolling list core dump bug

daniel@Sun.COM (Daniel Smith "fast screens, loud music, slow car") (11/28/90)

	[forwarded to me from a colleague]

	This is a really nasty bug that causes core dumps.

The problem is with scrolling lists. Here's a sample program to demonstrate.
If you press Select (button 1) on the text field below the list, then drag
into the list, the program aborts.

	Any feedback we could get from out there would be appreciated.

				Daniel

/***********************************************************************
* scrolllist_bug.c
*
* Press Select around the text field, drag into scrolled list -- blam.
*
* Needs -lxview -lX11 -lolgx to link
*
************************************************************************/

#include <xview/xview.h>
#include <xview/panel.h>

main(argc, argv)
int	argc;
char	**argv;
{
    Xv_opaque	frame, panel, list, textfield;
    int i;

    xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0);
    frame = xv_create(NULL, FRAME, NULL);
    panel = xv_create(frame, PANEL, PANEL_LAYOUT, PANEL_VERTICAL, NULL);

    list = xv_create(panel, PANEL_LIST,
		     XV_X, 10,
		     XV_Y, 10,
		     PANEL_LIST_WIDTH, 174,
		     PANEL_LABEL_STRING, "Items:",
		     PANEL_LAYOUT, PANEL_VERTICAL,
		     PANEL_LIST_DISPLAY_ROWS, 6,
		     NULL);
    for(i = 0; i < 10; ++i) 
    {
	char buf[14];
	sprintf(buf, "List Item %d", i);
	xv_set(list,
	       PANEL_LIST_INSERT, i,
	       PANEL_LIST_STRING, i, buf,
	       NULL);
    }
    textfield = xv_create(panel, PANEL_TEXT,
			  XV_X, 10,
			  PANEL_LABEL_STRING, "Select Here:",
			  PANEL_VALUE_DISPLAY_LENGTH, 15,
			  PANEL_READ_ONLY, TRUE,
			  NULL);

    window_fit(panel);
    window_fit(frame);
    xv_main_loop(frame);
}