Experimental Physics and
| |||||||||||||||
|
There is a problem with the Xt lib version distributed with RHEL5. Someone suggested that the latest version may be fixed but I'm not entirely sure about this. At the least, make sure you do have the latest version of X and Xt lib. Motif is not a problem. I have enclosed a test program that may demonstrate the problem. To build, place 1.c and makefile in a directory, cd into that directory, and type "make". This will build the executable file named 1. To run type "./1". The program launches a window with a menu bar to open additional windows. These additional windows contain a menu bar with an "exit" entry to close the window. In my experience, opening several of these windows (sometimes a few, sometimes 20-30) and then closing them eventually causes the same crash (at least the crash dump looks the same). This crash has an interesting history. As you may know, the XFree86 development was taken over by X.org because of a license issue in a particular version of XFree86. This same bug existed in a past version of the XFree86 distribution. Fortunately, it was fixed promptly. When I look at the crash dump, I strongly suspect the X.org development is following along the same path and has duplicated this bug. I am sending a copy of this reply to tech-talk in case anyone has solved this problem. John Sinclair mattei pierre wrote: Hello John, /* --------------------------------------------- * * This application creates a main window and raises it * approximately every 3 seconds. The only menu option * is "exit". * */ #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <math.h> #include <sys/types.h> #include <sys/time.h> #include <time.h> #include <wait.h> #include <signal.h> #include <unistd.h> #include <errno.h> #include <limits.h> #include <X11/Xlib.h> #include <X11/Intrinsic.h> #include <Xm/Xm.h> #include <Xm/AtomMgr.h> #include <Xm/Protocols.h> #include <Xm/MainW.h> #include <Xm/PushB.h> #include <Xm/CascadeB.h> #include <Xm/RowColumn.h> static int g_exit = 0; XtAppContext app; Display *display; Widget widgetToKill = NULL; void exit_cb ( Widget w, XtPointer client, XtPointer call ) { int *flag = (int *) client; printf( "exit_cb callback function was invoked\n" ); *flag = 1; } void exitOne_cb ( Widget w, XtPointer client, XtPointer call ) { printf( "exitOne_cb callback function was invoked\n" ); do { widgetToKill = w; w = XtParent( w ); } while ( w ); } void newWin_cb ( Widget w, XtPointer client, XtPointer call ) { Widget appTop1, mainWin1, menuBar1, filePullDown1, fileCascade1, exitB1; XmString menuStr, str; Atom wm_delete_window; appTop1 = XtVaAppCreateShell( NULL, "test", applicationShellWidgetClass, display, XmNiconic, False, XmNmappedWhenManaged, True, NULL ); mainWin1 = XtVaCreateManagedWidget( "main", xmMainWindowWidgetClass, appTop1, XmNscrollBarDisplayPolicy, XmAS_NEEDED, XmNscrollingPolicy, XmAUTOMATIC, NULL ); menuBar1 = XmCreateMenuBar( mainWin1, "menubar", NULL, 0 ); filePullDown1 = XmCreatePulldownMenu( menuBar1, "file", NULL, 0 ); menuStr = XmStringCreateLocalized( "file" ); fileCascade1 = XtVaCreateManagedWidget( "filemenu", xmCascadeButtonWidgetClass, menuBar1, XmNlabelString, menuStr, XmNmnemonic, 'f', XmNsubMenuId, filePullDown1, NULL ); XmStringFree( menuStr ); str = XmStringCreateLocalized( "exit" ); exitB1 = XtVaCreateManagedWidget( "pb", xmPushButtonWidgetClass, filePullDown1, XmNlabelString, str, NULL ); XmStringFree( str ); XtAddCallback( exitB1, XmNactivateCallback, exitOne_cb, (XtPointer) &g_exit ); XtManageChild( menuBar1 ); XtRealizeWidget( appTop1 ); wm_delete_window = XmInternAtom( display, "WM_DELETE_WINDOW", False ); XmAddWMProtocolCallback( appTop1, wm_delete_window, exitOne_cb, (XtPointer) &g_exit ); XtVaSetValues( appTop1, XmNdeleteResponse, XmDO_NOTHING, NULL ); } int main ( int argc, char **argv ) { Widget appTop, mainWin, menuBar, filePullDown, fileCascade, exitB; XmString menuStr, str; XEvent Xev; int result, isXEvent, n, count; struct timespec req, rem; Atom wm_delete_window; XtToolkitInitialize(); app = XtCreateApplicationContext(); display = XtOpenDisplay( app, NULL, NULL, "test", NULL, 0, &argc, argv ); appTop = XtVaAppCreateShell( NULL, "test", applicationShellWidgetClass, display, XmNiconic, False, XmNmappedWhenManaged, True, NULL ); mainWin = XtVaCreateManagedWidget( "main", xmMainWindowWidgetClass, appTop, XmNscrollBarDisplayPolicy, XmAS_NEEDED, XmNscrollingPolicy, XmAUTOMATIC, NULL ); menuBar = XmCreateMenuBar( mainWin, "menubar", NULL, 0 ); filePullDown = XmCreatePulldownMenu( menuBar, "file", NULL, 0 ); menuStr = XmStringCreateLocalized( "file" ); fileCascade = XtVaCreateManagedWidget( "filemenu", xmCascadeButtonWidgetClass, menuBar, XmNlabelString, menuStr, XmNmnemonic, 'f', XmNsubMenuId, filePullDown, NULL ); XmStringFree( menuStr ); str = XmStringCreateLocalized( "new" ); exitB = XtVaCreateManagedWidget( "pb", xmPushButtonWidgetClass, filePullDown, XmNlabelString, str, NULL ); XmStringFree( str ); XtAddCallback( exitB, XmNactivateCallback, newWin_cb, (XtPointer) &g_exit ); XtManageChild( menuBar ); XtRealizeWidget( appTop ); wm_delete_window = XmInternAtom( display, "WM_DELETE_WINDOW", False ); XmAddWMProtocolCallback( appTop, wm_delete_window, exit_cb, (XtPointer) &g_exit ); XtVaSetValues( appTop, XmNdeleteResponse, XmDO_NOTHING, NULL ); //------------------------------------------- n = 0; while ( !g_exit ) { count = 1000; do { result = XtAppPending( app ); if ( result ) { isXEvent = XtAppPeekEvent( app, &Xev ); if ( isXEvent ) { if ( Xev.type != Expose ) { XtAppProcessEvent( app, result ); } else { XtAppProcessEvent( app, result ); } } else { // process all timer or alternate events XtAppProcessEvent( app, result ); } } count--; } while ( result && count ); req.tv_sec = 0; req.tv_nsec = 100000000; nanosleep( &req, &rem ); // raise window approx every 3 seconds n++; if ( n == 30 ) { n = 0; printf( "call XRaiseWindow\n" ); XRaiseWindow( display, XtWindow(appTop) ); } if ( widgetToKill ) { XtDestroyWidget( widgetToKill ); widgetToKill = NULL; } } return 0; } CFLAGS = -Wall -O0 -g LDFLAGS = -g all : 1 1 : 1.o g++ $(LDFLAGS) -o 1 \ -L/usr/X11R6/lib \ -lXm -lXt -lX11 \ 1.o 1.o : 1.c cc $(CFLAGS) -o 1.o -c 1.c
| ||||||||||||||
ANJ, 02 Sep 2010 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |