Hello,

I found that format offered by SourceForge is not perfect for reports
with several source files attached, so I'm sending one via email.
Sorry if this is wrong way of submitting bugs/fixes. We really need
working Lesstif Mrm stuff.

Best regards,
    Andrei Rezvov

================================================
Lesstif version/platform:
    all recent versions (since 1999/05/28) of Lesstif,
    Linux Redhat 6.2 (and possibly all others)
Problem brief description:
    BUG: libMrm dumps core
How to reproduce the problem:
    The tests for libMrm are not included in the Lesstif distribution,
so please find below
the sources of a very simple sample program demonstrating the problem.

================================================

! motifanim.uil
! Build .uid with:
!    uil motifanim.uil -o motifanim.uid
!
module motifanim
!!!    version = 'v1.0'
    names = case_sensitive

object
    motifanim_main : XmMainWindow {
        controls {
            XmForm        motifanim_form ;
        };
    };

object
    motifanim_form : XmForm {
        controls {
            XmScrolledWindow    motifanim_view;
            XmSeparator         motifanim_sep;
            XmPushButton        motifanim_start;
        };
    };

object
    motifanim_start : XmPushButton {
        arguments {
            XmNlabelString = compound_string('Start');
            XmNbottomAttachment = XmATTACH_FORM ;
            XmNleftAttachment = XmATTACH_FORM ;
        };
    };

object
    motifanim_sep : XmSeparator {
        arguments {
            XmNrightAttachment = XmATTACH_FORM ;
            XmNleftAttachment = XmATTACH_FORM ;
            XmNbottomAttachment = XmATTACH_WIDGET ;
            XmNbottomWidget = motifanim_start ;
        };
    };

object
    motifanim_view : XmScrolledWindow {
        arguments {
            XmNrightAttachment = XmATTACH_FORM ;
            XmNtopAttachment = XmATTACH_FORM ;
            XmNbottomAttachment = XmATTACH_WIDGET ;
            XmNbottomWidget = XmSeparator motifanim_sep ;
            XmNleftAttachment = XmATTACH_FORM ;
            XmNscrollingPolicy = XmAUTOMATIC ;
        };
    };

end module;
================================================
/* motifanim.c
 * Build executable with:
 *    gcc -g -Wall -I/usr/X11R6/LessTif/Motif1.2/include
-I/usr/X11R6/include -I. -c motifanim.c
 *    gcc -g -Wall -L/usr/X11R6/lib -L/usr/X11R6/LessTif/Motif1.2/lib
-L. -o motifanim motifanim.o -lXm -lXt -lMrm -lX11
 */
#include <stdio.h>
#include <Xm/Xm.h>
#include <Mrm/MrmPublic.h>

static MrmHierarchy     s_MrmHierarchy;

static char             *vec[1] = { "motifanim.uid" };
static int              vecnum = sizeof(vec) / sizeof(char*);

static MrmCode          class ;

Display                 *display;
XtAppContext            app_context;

/******************************************************************
 *  Main program
 */
int main(argc, argv)
     int    argc;
     String argv[];
{
    Widget toplevel, motifanimmain = NULL ;

    MrmInitialize ();

    toplevel = XtAppInitialize(&app_context, "demos",
                               NULL , 0,
                               &argc,
                               argv,
                               NULL,
                               NULL, 0);

    if (MrmOpenHierarchyPerDisplay (XtDisplay(toplevel),
                        vecnum,          /* number of files         */
                        vec,             /* files           */
                        NULL,            /* os_ext_list (null)   */
                        &s_MrmHierarchy) /* ptr to returned id   */
                        != MrmSUCCESS) {
        printf ("can't open hierarchy\n");
        exit(0);
     }

    if (MrmFetchWidget (s_MrmHierarchy,
                        "motifanim_main",
                        toplevel,
                        &motifanimmain,
                        &class)
                        != MrmSUCCESS) {
        printf("can't fetch interface\n");
        exit(0);
    }

    XtManageChild(motifanimmain);

    XtRealizeWidget(toplevel);

    XtAppMainLoop(app_context);

    /* UNREACHABLE */
    return (0);
}
================================================
The sample program produces the following output:

Opening motifanim.uid
READ ATTRIBUTES
READ ATTRIBUTES
READ ATTRIBUTES
READ ATTRIBUTES
READ ATTRIBUTES
READING COMPLEX STRING
COMPLEX DONE
GLOBAL *******
LOCAL  0
oject motifanim_form: XmForm {
        arguments {
        };
        controls {
                XmScrolledWindow motifanim_view;
                XmSeparator motifanim_sep;
                XmPushButton motifanim_start;
        }
        callbacks {
        };
};
oject motifanim_main: XmMainWindow {
        arguments {
        };
        controls {
                XmForm motifanim_form;
        }
        callbacks {
        };
};
oject motifanim_view: XmScrolledWindow {
        arguments {
                rightAttachment = "XmATTACH_FORM";
                topAttachment = "XmATTACH_FORM";
                bottomAttachment = "XmATTACH_WIDGET";
                bottomWidget = "motifanim_sep";
                leftAttachment = "XmATTACH_FORM";
                scrollingPolicy = "XmAUTOMATIC";
        };
        controls {
        }
        callbacks {
        };
};
oject motifanim_sep: XmSeparator {
        arguments {
                rightAttachment = "XmATTACH_FORM";
                leftAttachment = "XmATTACH_FORM";
                bottomAttachment = "XmATTACH_WIDGET";
                bottomWidget = "motifanim_start";
        };
        controls {
        }
        callbacks {
        };
};
oject motifanim_start: XmPushButton {
        arguments {
                labelString = "Start";
                bottomAttachment = "XmATTACH_FORM";
                leftAttachment = "XmATTACH_FORM";
        };
        controls {
        }
        callbacks {
        };
};
Mrm.c:1064:Could not find motifanim_sep
Aborted (core dumped)
================================================
Trace from the debugger:

GNU gdb 4.17.0.11 with Linux support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-redhat-linux"...
Core was generated by `./motifanim'.
Program terminated with signal 6, Aborted.
Reading symbols from /usr/X11R6/lib/libXm.so.1...done.
Reading symbols from /usr/X11R6/lib/libXt.so.6...done.
Reading symbols from /usr/X11R6/lib/libMrm.so.1...done.
Reading symbols from /usr/X11R6/lib/libX11.so.6...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /usr/X11R6/lib/libSM.so.6...done.
Reading symbols from /usr/X11R6/lib/libICE.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
#0  0x4026d111 in __kill ()
(gdb) bt
#0  0x4026d111 in __kill ()
#1  0x4026cd66 in raise (sig=6) at ../sysdeps/posix/raise.c:27
#2  0x4026e447 in abort () at ../sysdeps/generic/abort.c:88
#3  0x401a1c8a in Exit ()
#4  0x4019ee53 in GetSymbolTableValue ()
#5  0x4019e4df in GetAttributes ()
#6  0x4019e0c9 in MrmFetchWidget ()
#7  0x4019df97 in MrmFetchWidget ()
#8  0x4019df97 in MrmFetchWidget ()
#9  0x8048811 in main (argc=1, argv=0xbffffd64) at motifanim.c:48
#10 0x40266cb3 in __libc_start_main (main=0x8048770 <main>, argc=1,
    argv=0xbffffd64, init=0x8048594 <_init>, fini=0x804889c <_fini>,
    rtld_fini=0x4000a350 <_dl_fini>, stack_end=0xbffffd5c)
    at ../sysdeps/generic/libc-start.c:78
(gdb) quit

================================================
Problem resolution

The following patch to lib/Mrm/lookup.c (obtained from current Lesstif
CVS repository)
resolves the problem:
$ cvs diff -uN lib/Mrm/lookup.c
Index: lib/Mrm/lookup.c
===================================================================
RCS file: /cvsroot/lesstif/lesstif/lib/Mrm/lookup.c,v
retrieving revision 1.7
diff -u -r1.7 lookup.c
--- lib/Mrm/lookup.c    2000/11/13 15:22:54     1.7
+++ lib/Mrm/lookup.c    2000/11/14 13:49:04
@@ -248,7 +248,7 @@
     {"XmNbottomPosition", XmNbottomPosition, CSG},
     {"XmNbottomShadowColor", XmNbottomShadowColor, CSG},
     {"XmNbottomShadowPixmap", XmNbottomShadowPixmap, CSG},
-    {"XmNbottomWidget", XmNbottomWidget, /* 0 */ CSG},
+    {"XmNbottomWidget", XmNbottomWidget, 0 /* CSG */},
     {"XmNbrowseSelectionCallback", XmNbrowseSelectionCallback, C},
     {"XmNbuttonAcceleratorText", XmNbuttonAcceleratorText, C},
     {"XmNbuttonAccelerators", XmNbuttonAccelerators, C},
@@ -525,7 +525,7 @@
     {"XmNleftAttachment", XmNleftAttachment, CSG},
     {"XmNleftOffset", XmNleftOffset, CSG},
     {"XmNleftPosition", XmNleftPosition, CSG},
-    {"XmNleftWidget", XmNleftWidget, /* 0 */ CSG},
+    {"XmNleftWidget", XmNleftWidget, 0 /* CSG */},
     {"XmNlightThreshold", XmNlightThreshold, C},
     {"XmNlistItemCount", XmNlistItemCount, CSG},
     {"XmNlistItems", XmNlistItems, CSG},
@@ -701,7 +701,7 @@
     {"XmNrightAttachment", XmNrightAttachment, CSG},
     {"XmNrightOffset", XmNrightOffset, CSG},
     {"XmNrightPosition", XmNrightPosition, CSG},
-    {"XmNrightWidget", XmNrightWidget, /* 0 */ CSG},
+    {"XmNrightWidget", XmNrightWidget, 0 /* CSG */},
     {"XmNrowColumnType", XmNrowColumnType, CG},
     {"XmNrows", XmNrows, CSG},
     {"XmNrubberPositioning", XmNrubberPositioning, CSG},
@@ -838,7 +838,7 @@
     {"XmNtopPosition", XmNtopPosition, CSG},
     {"XmNtopShadowColor", XmNtopShadowColor, CSG},
     {"XmNtopShadowPixmap", XmNtopShadowPixmap, CSG},
-    {"XmNtopWidget", XmNtopWidget, /* 0 */ CSG},
+    {"XmNtopWidget", XmNtopWidget, 0 /* CSG */},
     {"XmNtransferProc", XmNtransferProc, CSG},
     {"XmNtransferStatus", XmNtransferStatus, CSG},
     {"XmNtransient", XmNtransient, CSG},

================================================
Problem definition

In lib/Mrm/lookup.c, the constants C, S and G use same names as the
Motif access
permission symbols, but have different meaning. There shall not be
one-to-one correspondence between them.
This code was okay in lib/Mrm/lookup.c revision 1.2

================================================


Reply via email to