[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

3363.0. "Trouble filtering with the FileSelect widget" by 3D::GALLOTTA () Wed Sep 19 1990 18:06

    
    I'm having some trouble with a FileSelect widget. It appears that
    whenever I use a filter with a 'long' filter string, it trashes
    some memory somewhere in my application which causes it to crash.
    
    For example, filtering using *.tra causes no such problems, but if
    I use, say, [gallotta.ds]*.tra as a filter value, subsequent managing
    of the same FileSelect widget causes a memory overwrite, or so it
    appears. There is a structure that gets blown away and I can only
    pin it down to the value of the filter label. With short or no
    filter values, everything is OK.
    
    Is there any known problem with the FileSelect widget or am I doing
    something incorrectly that would cause this. I'm including the relevent
    portion of the code in the next reply. I would appreciate any comments,
    suggestions or solutions. The code is compiled using VMS 5.3.
    
    Thanks,
    
    Al 223-6588
    
T.RTitleUserPersonal
Name
DateLines
3363.1code fragment using FileSelect widget3D::GALLOTTAWed Sep 19 1990 18:0761
void 
get_file_name( ptr )
DISPLAY_SB	*ptr;
{

    if (!ptr->fileselect)
    {
	XtSetArg(arglist[0], DwtNactivateCallback, fil_ok_cb);
	XtSetArg(arglist[1], DwtNcancelCallback, fil_can_cb);
	fil_ok_cb[0].tag = ptr;
	fil_can_cb[0].tag = ptr;
	XtSetArg(arglist[2], DwtNdirMask, DwtLatin1String("*.tra") );
	XtSetArg(arglist[3], DwtNdirectionRToL, TRUE);
	XtSetArg(arglist[4], DwtNdefaultPosition, TRUE);
	XtSetArg(arglist[5], DwtNcols, 50);
	ptr->fileselect = DwtFileSelectionCreate( ptr->main, "", arglist, 6);

	XSync(ptr->disp,0);
    }

    XtManageChild(ptr->fileselect);

    return;
}

void
cb_fil_ok(widget, ptr, reason)
Widget		widget;
DISPLAY_SB	*ptr;
DwtFileSelectionCallbackStruct *reason;
{
    int d,status,charset,direction,language,rendition;
    char *tmp;
    DwtCompStringContext context;

    /* remove the file select widget */
    XtUnmanageChild(ptr->fileselect);

    if ( DwtInitGetSegment(&context, reason->value) == DwtSuccess )
    {
	if ( DwtGetNextSegment(&context, &tmp, &charset, &direction,
			&language, &rendition) != DwtSuccess )
	{
	    return;
	}
    }
    else
    {
	return;
    }

    sprintf(ptr->filename,"%s",tmp);

    XtFree(tmp);

    .
    .
    .

    
3363.2I am not sure, but ...HKOVC::TERENCEFrom Middlesex, UWOWed Sep 19 1990 22:4417
    Re: -1

    I am not sure whether that causes the problem, but I think that you
    need to terminate a callback list with a null.

#	fil_ok_cb[0].tag = ptr;
#	fil_can_cb[0].tag = ptr;

    fil_ok_cb[0].proc = (VoidProc)cb_fil_ok;
    fil_ok_cb[0].tag = ptr;
    fil_ok_cb[1].proc = (VoidProc)NULL;

    fil_can_cb[0].proc = (VoidProc)cb_fil_can;
    fil_can_cb[0].tag = ptr;
    fil_can_cb[1].proc = (VoidProc)NULL;

3363.3Not the solution...3D::GALLOTTAThu Sep 20 1990 12:028
    
    Yes, I do terminate the list with a NULL, it just wasn't shown in
    the code I submitted. I am still without a clue as to the problem
    I am seeing.
    
    Thanks,
    
    Al