I have the CVS version of OpenDX working now, and I can reproduce.

However, is the OpenDX code correct ?

It is passing this to _XmMapKeyEvents :
        KeySym  keysym = 0;
        KeySym  *keysym_list;
        count = _XmMapKeyEvents(accelerator, &type_list, &keysym_list, ...

Shouldn't keysym_list either point to allocated memory or be initialised to 0 ?

I'd expect something like this :
        KeySym  *keysym_list = XtCalloc(10, sizeof(KeySym));
or
        KeySym  *keysym_list = NULL;

(In the latter case I could detect inside LessTif and allocate memory
for this, but I'm not sure whether I should do this as I have no description
of what _XmMapKeyEvents() should do in this case. Currently I'm not
detecting it so the second suggestion would crash with LessTif.)

I made the first of my suggested changes above, and now I get a crash
further along. I stopped gdb around the previously guilty lines, and
printed some stuff :

(gdb) break 2040
Breakpoint 2 at 0x40170328: file MapEvent.c, line 2040.
(gdb) c
Continuing.

Breakpoint 2, _XmMapKeyEvents (str=0x842ce10 "Ctrl<Key>S", eventType=0xbffff114, 
    keysym=0xbffff110, modifiers=0xbffff10c) at MapEvent.c:2040
2040                    (*keysym)[i] = e->event.eventCode;
(gdb) p i
$1 = 0
(gdb) s
2041                    (*modifiers)[i] = e->event.modifiers;
(gdb) s
2042                    i++;
(gdb) p *keysym
$2 = (KeySym *) 0x8473940
(gdb) p *keysym[0]
$3 = 83
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x080b2c86 in EditorWindow::doSelectedNodesDefaultAction ()
(gdb) q


This may still be a LessTif problem, but I cannot tell without
further investigation. Rob, do you have insights ?

        Danny

Alexander Mai wrote:
> 
> On Thu, 11 Apr 2002 21:05:08 +0200, Danny Backx wrote:
> 
> >Hmm, we're probably using the same version of LessTif but not OpenDX.
> >I am using 4.1.3. I don't see a call of _XmMapKeyEvents anywhere.
> >Are you using the CVS version of OpenDX ?
> >
> >       Danny
> 
> I can jump in here - I checked out OpenDX/CVS meanwhile! :)
> 
> configure checks for _XmMapKeyEvents()!
> The code itself seems to be:
> 
> /*
> ** The Public Interface to the above.
> */
> 
> #ifndef   _NO_PROTO
> Boolean TransferAccelerator(Widget shell, Widget source, String action)
> #else  /* _NO_PROTO */
> Boolean TransferAccelerator(shell, source, action)
>         Widget shell ;
>         Widget source ;
>         String action ;
> #endif /* _NO_PROTO */
> {
>         /*
>         ** Installs an accelerator on shell to fire button source
>         ** using the same accelerator
>         */
> 
>         char     *accelerator = (char *) 0 ;
>         Boolean   retcode     = False ;
>         KeySym    keysym=0 ;
>         Modifiers modifiers=0 ;
> 
>         /*
>         ** Fetch the accelerator for the given source of the event.
>         */
> 
>         XtVaGetValues(source, XmNaccelerator, &accelerator, NULL) ;
> 
>         if (accelerator != (char *) 0) {
>                 /*
>                 ** Convert the accelerator to KeySym/Modifier combination.
>                 */
> 
> #if defined(HAVE_XMMAPKEYEVENTS)
>                 int        count ;
>                 int       *type_list;
>                 KeySym    *keysym_list ;
>                 Modifiers *modifiers_list ;
> 
>                 count = _XmMapKeyEvents(accelerator, &type_list, &keysym_list,
> &modifiers_list) ;
> 
>                 if (count > 0) {
>                         keysym    = *keysym_list ;
>                         modifiers = *modifiers_list ;
>                         retcode   = True ;
>                 }
> #else  /* (HAVE_XMMAPKEYEVENTS) */
>                 int       type ;
>                 retcode = _XmMapKeyEvent(accelerator, &type, (unsigned *)
> &keysym,
>                              &modifiers) ;
> #endif /* (HAVE_XMMAPKEYEVENTS) */
> 
>                 /*
>                 ** Install the action.
>                 */
> 
>                 if (retcode == True) {
>                         retcode = InstallAccelerator(shell, keysym, modifiers,
> source, action) ;
>                 }
> 
>                 XtFree(accelerator) ;
>         }
> 
>         return retcode ;
> }
> 
> ---
> Alexander Mai
> [EMAIL PROTECTED]
> 
> _______________________________________________
> Lesstif mailing list
> [EMAIL PROTECTED]
> https://terror.hungry.com/mailman/listinfo/lesstif

-- 
Danny Backx ([EMAIL PROTECTED] [EMAIL PROTECTED])
Home page :     http://users.skynet.be/danny.backx
Projects:       LessTif (http://www.lesstif.org)
                Oleo    (http://www.gnu.org/software/oleo/oleo.html)
_______________________________________________
Lesstif mailing list
[EMAIL PROTECTED]
https://terror.hungry.com/mailman/listinfo/lesstif

Reply via email to