From f161484e8ba50495a84a24c63f2849d4a2a53fb6 Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Wed, 29 Aug 2012 09:42:34 -0400 Subject: Bug 387496 - JVM crashes when running jdtuirefactoring tests on hudson: im-xim.so+0x3b04 --- bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c | 10 ++++++++++ .../org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c | 5 +++-- .../org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h | 1 + .../gtk/org/eclipse/swt/internal/gtk/OS.java | 11 +++++++++++ .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java | 14 -------------- .../Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java | 7 +++++++ 6 files changed, 32 insertions(+), 16 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c index 704e487a71..90c1ebac16 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c @@ -13880,6 +13880,16 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1toolbar_1new) } #endif +#ifndef NO__1gtk_1toolbar_1set_1icon_1size +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1toolbar_1set_1icon_1size) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + OS_NATIVE_ENTER(env, that, _1gtk_1toolbar_1set_1icon_1size_FUNC); + gtk_toolbar_set_icon_size((GtkToolbar *)arg0, arg1); + OS_NATIVE_EXIT(env, that, _1gtk_1toolbar_1set_1icon_1size_FUNC); +} +#endif + #ifndef NO__1gtk_1toolbar_1set_1orientation JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1toolbar_1set_1orientation) (JNIEnv *env, jclass that, jintLong arg0, jint arg1) 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 1bc0376697..119f1c66aa 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 = 1334; -int OS_nativeFunctionCallCount[1334]; +int OS_nativeFunctionCount = 1335; +int OS_nativeFunctionCallCount[1335]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -1062,6 +1062,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1tool_1item_1set_1proxy_1menu_1item", "_1gtk_1toolbar_1insert", "_1gtk_1toolbar_1new", + "_1gtk_1toolbar_1set_1icon_1size", "_1gtk_1toolbar_1set_1orientation", "_1gtk_1toolbar_1set_1show_1arrow", "_1gtk_1toolbar_1set_1style", 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 0f8e23db7e..20250dbe2b 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 @@ -1070,6 +1070,7 @@ typedef enum { _1gtk_1tool_1item_1set_1proxy_1menu_1item_FUNC, _1gtk_1toolbar_1insert_FUNC, _1gtk_1toolbar_1new_FUNC, + _1gtk_1toolbar_1set_1icon_1size_FUNC, _1gtk_1toolbar_1set_1orientation_FUNC, _1gtk_1toolbar_1set_1show_1arrow_FUNC, _1gtk_1toolbar_1set_1style_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 77cdf50766..c2310b7878 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 @@ -10726,6 +10726,17 @@ public static final void gtk_toolbar_set_style(int /*long*/ toolbar, int style) lock.unlock(); } } +/** @param toolbar cast=(GtkToolbar *) + */ +public static final native void _gtk_toolbar_set_icon_size(int /*long*/ toolbar, int size); +public static final void gtk_toolbar_set_icon_size(int /*long*/ toolbar, int size) { + lock.lock(); + try { + _gtk_toolbar_set_icon_size(toolbar, size); + } finally { + lock.unlock(); + } +} /** @method flags=dynamic */ public static final native int /*long*/ _gtk_tooltips_data_get(int /*long*/ widget); public static final int /*long*/ gtk_tooltips_data_get(int /*long*/ widget) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java index 7993e54757..e23576990a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java @@ -4260,21 +4260,7 @@ public boolean setParent (Composite parent) { oldDecorations.fixAccelGroup (); } int /*long*/ newParent = parent.parentingHandle(); - - /* - * Bug in GTK. GTK will segment fault if gtk_widget_reparent() is called - * on a toolbar or on a widget hierarchy containing a toolbar. The fix is - * to reparent by removing the widget from its current parent and adding it - * to the new parent. - * - * Temporarily put back for bug#387496. - */ OS.gtk_widget_reparent(topHandle, newParent); -// OS.g_object_ref (topHandle); -// OS.gtk_container_remove (OS.gtk_widget_get_parent (topHandle), topHandle); -// OS.gtk_container_add (newParent, topHandle); -// OS.g_object_unref (topHandle); - OS.gtk_fixed_move (newParent, topHandle, x, y); /* * Restore the original widget size since GTK does not keep it. diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java index 821beed3b0..0ba8e94db7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java @@ -138,6 +138,13 @@ void createHandle (int index) { byte [] swt_toolbar_flat = Converter.wcsToMbcs (null, "swt-toolbar-flat", true); OS.gtk_widget_set_name (handle, swt_toolbar_flat); } + /* + * Bug in GTK. GTK will segment fault if gtk_widget_reparent() is called + * on a toolbar or on a widget hierarchy containing a toolbar when the icon + * size is not GTK_ICON_SIZE_LARGE_TOOLBAR. The fix is to set the icon + * size to GTK_ICON_SIZE_LARGE_TOOLBAR. + */ + OS.gtk_toolbar_set_icon_size (handle, OS.GTK_ICON_SIZE_LARGE_TOOLBAR); } public Point computeSize (int wHint, int hHint, boolean changed) { -- cgit