1 /* $Id: test18.c,v 1.4 2001/05/15 14:20:18 amai Exp $ */
2
3 #if 0
4 From: "Eric C. Newton" <ecn@smart.net>
5 To: Rick Scott <rwscott@omnisig.com>
6 Subject: Re: mem overwrite in MessageB.c
7 Date: Sun, 15 Nov 1998 08:40:15 -0500
8 Cc: lesstif@hungry.com
9
10
11 Rick Scott writes:
12 > I would be interested in seeing the intimate details of how your
13 > MessageBox is put together. _XmGeoMatrixAlloc does alloc nrows + 1, so
14 > it would seem that in your case the number of rows that we are calculating
15 > is not the same as the number of rows that we are laying out to. If you
16 > could rip the relevent MessageBox code out into a separate little app, like
17 > the existing tests, it would help alot.
18
19 My guess is that it is off by one because I am unmanaging the Ok button.
20 Here is the application stripped down to the minimum.
21
22 -Eric
23 #endif
24
25
26 #include <stdlib.h>
27 #include <stdio.h>
28
29 #include <Xm/Xm.h>
30 #include <Xm/PushB.h>
31 #include <Xm/MessageB.h>
32 #include <Xm/Form.h>
33
34 #include "../../common/Test.h"
35
36 static Widget dialog = NULL;
37
CreateConfigWindow(Widget w)38 static Widget CreateConfigWindow (Widget w)
39 {
40
41 if (! dialog)
42 {
43 Widget form;
44 dialog = XmCreateMessageDialog (w, "ConfigWindow", 0, 0);
45 XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_OK_BUTTON));
46 form = XmCreateForm (dialog, "form", 0, 0);
47 XtManageChild (form);
48 XtManageChild (dialog);
49 }
50 return (dialog);
51 }
52
main(int argc,char ** argv)53 int main(int argc, char**argv)
54 {
55 Widget top_level;
56 void * foo = malloc(10); /* reference malloc to get efence */
57 Widget pb;
58
59 top_level = XtVaAppInitialize (NULL, "Testit", NULL, 0,
60 &argc, argv, NULL, NULL);
61 pb = XmCreatePushButton(top_level, "test", 0, 0);
62 XtAddCallback(pb, XmNactivateCallback, (XtCallbackProc)CreateConfigWindow, NULL);
63 XtManageChild(pb);
64 XtRealizeWidget(top_level);
65 LessTifTestWaitForIt(top_level);
66 LessTifTestPushButton(pb);
67
68
69 {
70 static XtWidgetGeometry Expected[] = {
71 CWWidth | CWHeight , 6, 57, 154, 102, 0,0,0, /* ConfigWindow */
72 CWWidth | CWHeight | CWX | CWY, 0, 0, 4, 4, 0,0,0, /* Symbol */
73 CWWidth | CWHeight | CWX | CWY, 11, 11, 132, 4, 0,0,0, /* Message */
74 CWWidth | CWHeight | CWX | CWY, 0, 36, 154, 2, 0,0,0, /* Separator */
75 CWWidth | CWHeight | CWX | CWY, 11, 48, 66, 43, 0,0,0, /* Cancel */
76 CWWidth | CWHeight | CWX | CWY, 77, 48, 66, 43, 0,0,0, /* Help */
77 CWWidth | CWHeight | CWX | CWY, 11, 25, 132, 1, 0,0,0, /* form */
78 };
79 PrintDetails(dialog,Expected);
80 };
81 LessTifTestMainLoop(top_level);
82
83 return 0;
84 }
85
86
87