summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed <grant_gayed@ca.ibm.com>2012-09-17 16:04:18 -0400
committerGrant Gayed <grant_gayed@ca.ibm.com>2012-09-17 16:04:18 -0400
commit26a93997742e3fbea259c9c103559f5ff6796c72 (patch)
tree3bd46264b130edc3440c78c28dfa0af302ef480d
parent485114f5d5793888a7c4915b2bbbb32768f3e0f5 (diff)
downloadeclipse.platform.swt-26a93997742e3fbea259c9c103559f5ff6796c72.tar.gz
eclipse.platform.swt-26a93997742e3fbea259c9c103559f5ff6796c72.tar.xz
eclipse.platform.swt-26a93997742e3fbea259c9c103559f5ff6796c72.zip
Bug 324435 - JVM crashes when press a button
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java4
6 files changed, 51 insertions, 6 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
index efdb5a24a2..d19f091fe0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
@@ -19,6 +19,39 @@
#define OS_NATIVE(func) Java_org_eclipse_swt_internal_gtk_OS_##func
+#ifndef NO__1call_1get_1size
+JNIEXPORT void JNICALL OS_NATIVE(_1call_1get_1size)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3, jintLong arg4, jintLong arg5, jintLong arg6, jintLong arg7)
+{
+ /*
+ * Bug in Solaris. For some reason, the assembler generated for this function (when not putting the parameters in the stack) crashes.
+ * It seems that this is caused by a bug in the Sun Studio Compiler when the optimization level is greater or equal to two.
+ * The fix is rewrite the function passing all parameters on the stack. Alternatively, the problem could be fixed by lowering the optimization level,
+ * but this solution would significantly increase the size of the library.
+ */
+ const GdkRectangle rect;
+ gint x, y, width, height;
+ const GdkRectangle *lprect = NULL;
+ gint* lpx = NULL;
+ gint* lpy = NULL;
+ gint* lpwidth = NULL;
+ gint* lpheight = NULL;
+ OS_NATIVE_ENTER(env, that, _1call_1get_1size_FUNC);
+ if (arg3) lprect = &rect;
+ if (arg4) lpx = &x;
+ if (arg5) lpy = &y;
+ if (arg6) lpwidth = &width;
+ if (arg7) lpheight = &height;
+ ((void (*)(GtkCellRenderer *, GtkWidget *, const GdkRectangle *, gint *, gint *, gint *, gint *))arg0)((GtkCellRenderer *)arg1, (GtkWidget *)arg2, lprect, lpx, lpy, lpwidth, lpheight);
+ if (arg3) *((GdkRectangle *)arg3) = rect;
+ if (arg4) *((gint *)arg4) = x;
+ if (arg5) *((gint *)arg5) = y;
+ if (arg6) *((gint *)arg6) = width;
+ if (arg7) *((gint *)arg7) = height;
+ OS_NATIVE_EXIT(env, that, _1call_1get_1size_FUNC);
+}
+#endif
+
#ifndef NO_GDK_1WINDOWING_1X11
JNIEXPORT jboolean JNICALL OS_NATIVE(GDK_1WINDOWING_1X11)
(JNIEnv *env, jclass that)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index c664affb05..2dbd895edf 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -18,8 +18,8 @@
#ifdef NATIVE_STATS
-int OS_nativeFunctionCount = 1344;
-int OS_nativeFunctionCallCount[1344];
+int OS_nativeFunctionCount = 1345;
+int OS_nativeFunctionCallCount[1345];
char * OS_nativeFunctionNames[] = {
#ifndef JNI64
"Call__IIII",
@@ -208,6 +208,7 @@ char * OS_nativeFunctionNames[] = {
"_1atk_1object_1add_1relationship",
"_1atk_1object_1remove_1relationship",
"_1call",
+ "_1call_1get_1size",
"_1dlclose",
"_1dlopen",
"_1dlsym",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index 9276e7f987..607863df6f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -216,6 +216,7 @@ typedef enum {
_1atk_1object_1add_1relationship_FUNC,
_1atk_1object_1remove_1relationship_FUNC,
_1call_FUNC,
+ _1call_1get_1size_FUNC,
_1dlclose_FUNC,
_1dlopen_FUNC,
_1dlsym_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 457369a96d..421703038c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -804,6 +804,16 @@ public static final int /*long*/ call (int /*long*/ function, int /*long*/ arg0,
}
}
/** @method flags=no_gen */
+public static final native void _call_get_size (int /*long*/ function, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ arg3, int /*long*/ arg4, int /*long*/ arg5, int /*long*/ arg6);
+public static final void call_get_size (int /*long*/ function, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ arg3, int /*long*/ arg4, int /*long*/ arg5, int /*long*/ arg6) {
+ lock.lock();
+ try {
+ _call_get_size(function, arg0, arg1, arg2, arg3, arg4, arg5, arg6);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=no_gen */
public static final native boolean GDK_WINDOWING_X11();
/** @param pixmap cast=(GdkPixmap *) */
public static final native int /*long*/ _GDK_PIXMAP_XID(int /*long*/ pixmap);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index 70621ce8c7..6c08ac3d7b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -2478,7 +2478,7 @@ int /*long*/ rendererGetSizeProc (int /*long*/ cell, int /*long*/ widget, int /*
int /*long*/ g_class = OS.g_type_class_peek_parent (OS.G_OBJECT_GET_CLASS (cell));
GtkCellRendererClass klass = new GtkCellRendererClass ();
OS.memmove (klass, g_class);
- int /*long*/ result = OS.call (klass.get_size, cell, handle, cell_area, x_offset, y_offset, width, height);
+ OS.call_get_size (klass.get_size, cell, handle, cell_area, x_offset, y_offset, width, height);
if (!ignoreSize && OS.GTK_IS_CELL_RENDERER_TEXT (cell)) {
int /*long*/ iter = OS.g_object_get_qdata (cell, Display.SWT_OBJECT_INDEX2);
TableItem item = null;
@@ -2533,7 +2533,7 @@ int /*long*/ rendererGetSizeProc (int /*long*/ cell, int /*long*/ widget, int /*
}
}
}
- return result;
+ return 0;
}
int /*long*/ rendererRenderProc (int /*long*/ cell, int /*long*/ window, int /*long*/ widget, int /*long*/ background_area, int /*long*/ cell_area, int /*long*/ expose_area, int /*long*/ flags) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index f3a061833a..c8f04a5751 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -2481,7 +2481,7 @@ int /*long*/ rendererGetSizeProc (int /*long*/ cell, int /*long*/ widget, int /*
int /*long*/ g_class = OS.g_type_class_peek_parent (OS.G_OBJECT_GET_CLASS (cell));
GtkCellRendererClass klass = new GtkCellRendererClass ();
OS.memmove (klass, g_class);
- int /*long*/ result = OS.call (klass.get_size, cell, handle, cell_area, x_offset, y_offset, width, height);
+ OS.call_get_size (klass.get_size, cell, handle, cell_area, x_offset, y_offset, width, height);
if (!ignoreSize && OS.GTK_IS_CELL_RENDERER_TEXT (cell)) {
int /*long*/ iter = OS.g_object_get_qdata (cell, Display.SWT_OBJECT_INDEX2);
TreeItem item = null;
@@ -2531,7 +2531,7 @@ int /*long*/ rendererGetSizeProc (int /*long*/ cell, int /*long*/ widget, int /*
}
}
}
- return result;
+ return 0;
}
int /*long*/ rendererRenderProc (int /*long*/ cell, int /*long*/ window, int /*long*/ widget, int /*long*/ background_area, int /*long*/ cell_area, int /*long*/ expose_area, int /*long*/ flags) {