Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!i2unix!esacs!pizzi From: pizzi@esacs.UUCP (Riccardo Pizzi) Newsgroups: comp.windows.x.motif Subject: XmFileSelectionBox is buggy Keywords: XmFileSelectionBox, bug, Motif Message-ID: <1202@esacs.UUCP> Date: 2 Aug 90 15:48:38 GMT Organization: ESA C. & S. , Rimini,ITALY Lines: 42 I decided to write a simple test program for the FileSelectionBox widget and discovered some nasty and (let me say it) stupid bugs. They pertains to the DoSearch() routines and will very likely cause random core dumps. BTW, that's Motif 1.0a, no 1.1 yet... :-( I don't know if these bugs are already in some official bugs list, so I will post them anyway. SYMPTOMS: if you fill the File Filter field with a bad path, the application dies. Pick up the FileSB.c file and look at line 907 in DoFileSearch()... you can see here that, if there are no matching files in the search directory, a standard "" line is placed in the list and the num_files variable is set to 1. Now the ugly stuff... around line 959 they tries to free some memory that in case of no matching files has not been effectively allocated. To fix, either use strdup() at 907 or put an "if (!no_match)" before line 957. SYMPTOMS: Calling XmFileSelectionDoSearch() sometimes the application dies. In the same file as above (FileSB.c), in the public routine XmFileSelectionDoSearch() there are two very obvious mistakes... look at lines 1726 and 1739, you can very easily see that the call to XmStringLength() looks somewhat strange... in fact, there should be an XmString as parameter to the function and not an int! To fix, put search_data.value instead of search_data.length at line 1726 and search_data.mask at line 1739. That's all... this is the result of my first experience with this widget (I never used it before), but it is clear to me that this part of the Motif code has *never* been tested by the dev team :-( l8er... - Rick - -- Riccardo Pizzi @ ESA Software, Rimini, Italy This is a hand-made signature. -- Riccardo Pizzi @ ESA Software srl - ITALY uunet: ....mcsun!i2unix!esacs!pizzi voice: (0039) 541 741113 fax: (0039) 541 742153 UnixBBS: (0039) 541 27858 PEP