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 |
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.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
3363.1 | code fragment using FileSelect widget | 3D::GALLOTTA | Wed Sep 19 1990 18:07 | 61 | |
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.2 | I am not sure, but ... | HKOVC::TERENCE | From Middlesex, UWO | Wed Sep 19 1990 22:44 | 17 |
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.3 | Not the solution... | 3D::GALLOTTA | Thu Sep 20 1990 12:02 | 8 | |
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 |