I think looking at those sizes is a really good idea, even though I do not believe the problem has to do with "running in 64bit mode". Should Sridhar run 64bit, SWT would crash much earlier. Now, on the subject of "crashing somewhere after, if we remove the FillPolygon call" indicating a memory corruption. Do I understand it properly that this second problem is XSetValues? If so, then it's not a memory corruption, but our old known problem that was causing us grief on AIX?
-----platform-swt-dev-admin@xxxxxxxxxxx wrote: -----
To: platform-swt-dev@xxxxxxxxxxx
From: Steve_Northover@xxxxxxx
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
Date: 03/04/2002 11:39AM
Subject: Re: [platform-swt-dev] Running ControlExample example programfailsunderHP-UX
Can you print out the size of "short" and "int" in a C program?
Steve
| Sridhar Bidigalu <sridhar@xxxxxxx> Sent by: platform-swt-dev-admin@xxxxxxxxxxx03/04/02 11:52 AM Please respond to platform-swt-dev
| To: platform-swt-dev@xxxxxxxxxxx cc: Subject: Re: [platform-swt-dev] Running ControlExample example programfailsunderHP-UX |
Sorry Steve, for this misunderstanding. >My reading of the situation is as follows:
> - high level Java SWT code (Grant's example) does not draw
True.
> - low level Java PI code (Steve's example) does not draw
False, it works, sorry for the misunderstanding here.
> - C code translated from low level PI Java code draws
True.
>Is this true? If so, this point to a problem in our JNI code for XFillPolygon.
>We've all had a look at it and can't see any obvious problems. The fact
>that when you don't call this code you fail in another place (starting Eclipse)
>points to memory corruption.
>Can you confirm?
The problem is not in the JNI code, it occurs within the SWT
(Java wrappers). As I said in my previous email, making the points data
type to be integer and then casting it to XPoints(short), fails to draw the
polygon, even in the C code. I am playing around with SWT, given the
idea of writing examples as Steve provided.
Please note: I am building it on a 64 bit architecture, but by default it
builds 32 bit. Hopefully, this would not be the cause.
-Sri
Steve_Northover@xxxxxxx wrote:
Steve
| Sridhar Bidigalu <sridhar@xxxxxxx> Sent by: platform-swt-dev-admin@xxxxxxxxxxx 03/01/02 04:47 PM Please respond to platform-swt-dev | To: platform-swt-dev@xxxxxxxxxxx cc: Subject: Re: [platform-swt-dev] Running ControlExample example programfailsunderHP-UX |
One other thing, if I make the points array to be of
any other data type, it does not work.(It comes with
the shell, but no polygon). I never thought, it would be
so strict.
-Sri
Sridhar Bidigalu wrote:
Steve,
Oops! sorry for the delay. Please, refer to the
C code below. Actually, both the code sent by
you and the code listed below works.
#include <stdio.h>
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
main (int argc, char **argv)
{
Widget shellHandle;
Display *xDisplay;
XtAppContext xtContext;
XEvent xEvent;
Window xWindow;
GC xGC;
XPoint *ppts;
short xPoints[] = {10, 10, 100, 100, 100, 10};
XtToolkitInitialize();
xtContext = XtCreateApplicationContext();
xDisplay = XtOpenDisplay(xtContext, NULL, NULL, NULL,
0, 0, &argc, 0);
/* Initialize the Toolkit */
shellHandle = XtAppCreateShell(NULL, NULL,
topLevelShellWidgetClass,
xDisplay, NULL, 0);
XtResizeWidget(shellHandle, 200, 200, 0);
XtRealizeWidget (shellHandle);
/* Check and dispatch events forever */
while (True)
{
XtAppNextEvent(xtContext, &xEvent);
XtDispatchEvent(&xEvent);
switch (xEvent.type)
{
case Expose:
{
xWindow = XtWindow(shellHandle);
if (xWindow != NULL)
{
xGC = XCreateGC(xDisplay, xWindow, 0, NULL);
XFillPolygon(xDisplay, xWindow, xGC, (XPoint *)xPoints, 3, 0, 0);
XFreeGC(xDisplay, xGC);
}
}
default:
break;
}
}
}
-Sri
Steve_Northover@xxxxxxx wrote:
So, you need to translate the Java code to C and see if this works.
Please post the C code when you are done. Thanks.
Steve
| Mike_Wilson@xxxxxxx Sent by: platform-swt-dev-admin@xxxxxxxxxxx 03/01/02 11:23 AM Please respond to platform-swt-dev | To: platform-swt-dev@xxxxxxxxxxx cc: Subject: Re: [platform-swt-dev] Running ControlExample example program failsunderHP-UX |
Well, if this code fails, but the equivalent C version works, then the problem is some bad interaction with HP-UX in the implementations of those particular OS.xxx methods. This ought to be reasonably easy to find by inspecting their implementations. That's why it makes sense to run the low level version.
If however, the matching C code version fails, then you have a bug in the HP-UX Xt library which you have to either workaround or get fixed with HP's help.
McQ.
| Sridhar Bidigalu <sridhar@xxxxxxx> Sent by: platform-swt-dev-admin@xxxxxxxxxxx 03/01/2002 10:46 AM Please respond to platform-swt-dev | To: platform-swt-dev@xxxxxxxxxxx cc: Subject: Re: [platform-swt-dev] Running ControlExample example program failsunderHP-UX |
Steve,
I sent a email on this yesterday, probably it did not go thru., since
I sent it from my home email account.
Same behavior, no changes, shell pops up without polygon get drawn.
-Sri
Steve_Northover@xxxxxxx wrote:
Does this code work on HPUX?
Steve
public static void main (String [] args) {
OS.XtToolkitInitialize ();
int [] argc = new int [] {0};
final int xtContext = OS.XtCreateApplicationContext ();
int xDisplay = OS.XtOpenDisplay (xtContext, null, null, null, 0, 0, argc, 0);
int widgetClass = OS.TopLevelShellWidgetClass ();
int shellHandle = OS.XtAppCreateShell (null, null, widgetClass, xDisplay, null, 0);
OS.XtResizeWidget (shellHandle, 200, 200, 0);
OS.XtRealizeWidget (shellHandle);
short [] xPoints = {10, 10, 100, 100, 100, 10};
XAnyEvent xEvent = new XAnyEvent ();
while (true) {
OS.XtAppNextEvent (xtContext, xEvent);
OS.XtDispatchEvent (xEvent);
//Bogus to do this really ...
if (xEvent.type == OS.Expose) {
int xWindow = OS.XtWindow (shellHandle);
if (xWindow != 0) {
int xGC = OS.XCreateGC (xDisplay, xWindow, 0, null);
OS.XFillPolygon(xDisplay, xWindow, xGC, xPoints, xPoints.length / 2, OS.Complex, OS.CoordModeOrigin);
OS.XFreeGC (xDisplay, xGC);
}
}
}
}
| Boris_Shingarov@xxxxxxx Sent by: platform-swt-dev-admin@xxxxxxxxxxx 02/28/02 01:58 PM Please respond to platform-swt-dev | To: platform-swt-dev@xxxxxxxxxxx cc: Subject: Re: [platform-swt-dev] Running ControlExample example program failsunderHP-UX |
Sridhar,
This means we need to proceed with an OS.* calls test.
Steve: you have a pile of those in your image, could you share one?
P.S.: Drawing to Canvas vs. Shell should make no difference, as Shells are Canvases.
| Sridhar Bidigalu <sridhar@xxxxxxx> Sent by: platform-swt-dev-admin@xxxxxxxxxxx 02/28/2002 01:29 PM Please respond to platform-swt-dev | To: platform-swt-dev@xxxxxxxxxxx cc: Subject: Re: [platform-swt-dev] Running ControlExample example program failsunderHP-UX |
Grant,
I modified the sample examples you sent with ...
e.gc.drawPolyline(points);
and it draws the polyline. Looks like fillPolygon fails to draw.
Same behavior on the canvas too. But, it does not hang as it use
to, running the "controlexample" or the "eclipse" itself using the
fillPolygon, shell popsup without fillPolygon.
-Sri
Grant_Gayed@xxxxxxx wrote:
> Sridhar,
>
> Can you try the following shorter example and let us know if it hangs:
>
> import org.eclipse.swt.events.*;
> import org.eclipse.swt.graphics.*;
> import org.eclipse.swt.widgets.*;
>
> public class TestFillPolygon {
> public static void main (String[] args) {
> final int[] points = new int[] {771,6,771,16,766,11};
> final Display display = new Display ();
> Shell shell = new Shell (display);
> shell.setBounds (10, 10, 800, 90);
> shell.addPaintListener(new PaintListener () {
> public void paintControl (PaintEvent e) {
> Color colour = new Color(display,new
> RGB(222,233,244));
> e.gc.setBackground(colour);
> colour.dispose();
> e.gc.fillPolygon(points);
> }
> });
> shell.open ();
> while (!shell.isDisposed ()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
> }
> }
>
> Grant
>
> Mike,
>
> Thanks for the response. Yes, the arguments look reasonable enough and I
> have already gone
> thru. listing out the <xy> points, the drawable, display and the GC with
> their respective style
> and mode, which is the default(Complex & CoordModeOrigin). Also, tried with
> the different
> combinations of shape and mode arguments, no change. Created a simple
> example C program,
> which contains the same points as the one in the controlexample program,
> and the XFillPolygon
> works fine. I have attached the controlexample log file where it list out
> the debug info. of the
> JNI code before hanging in XFillPolygon. And also, note that, by replacing
> it with XDrawLines
> draws the lines on the arrow button of the Tab widget and runs the
> controlexample pgm just
> fine.
>
> I will go thru. more thoroughly on the HP documentation for any hints or
> specifics for the above
> problem to occur.
>
> Thanks
> -Sri
>
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev