diff options
author | Carolyn MacLeod <carolyn> | 2010-09-13 17:44:59 +0000 |
---|---|---|
committer | Carolyn MacLeod <carolyn> | 2010-09-13 17:44:59 +0000 |
commit | 9fd42911fcf8473bd7e2ec1d2465e49ce9c5bb6a (patch) | |
tree | 04ccbb7e042fbd44d69421d076c4b42d02fe981f | |
parent | 96c5ab1379291bdde5a1df53ca777ec911f1f1af (diff) | |
download | eclipse.platform.swt-9fd42911fcf8473bd7e2ec1d2465e49ce9c5bb6a.tar.gz eclipse.platform.swt-9fd42911fcf8473bd7e2ec1d2465e49ce9c5bb6a.tar.xz eclipse.platform.swt-9fd42911fcf8473bd7e2ec1d2465e49ce9c5bb6a.zip |
Bug 325028 - [a11y] Frequent crashes in editor resulting from atk_object_get_attributes()
5 files changed, 49 insertions, 22 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java index 07ef376dd9..ec4c6466e6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/gtk/org/eclipse/swt/accessibility/AccessibleObject.java @@ -545,42 +545,42 @@ class AccessibleObject { attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_LEFT_MARGIN)); attr.value = getStringPtr (String.valueOf(event.leftMargin)); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - parentResult = OS.g_list_append(parentResult, attrPtr); + parentResult = OS.g_slist_append(parentResult, attrPtr); } if (event.rightMargin != -1) { int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_RIGHT_MARGIN)); attr.value = getStringPtr (String.valueOf(event.rightMargin)); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - parentResult = OS.g_list_append(parentResult, attrPtr); + parentResult = OS.g_slist_append(parentResult, attrPtr); } if (event.topMargin != -1) { int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = getStringPtr ("top-margin"); //$NON-NLS-1$ attr.value = getStringPtr (String.valueOf(event.topMargin)); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - parentResult = OS.g_list_append(parentResult, attrPtr); + parentResult = OS.g_slist_append(parentResult, attrPtr); } if (event.bottomMargin != -1) { int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = getStringPtr ("bottom-margin"); //$NON-NLS-1$ attr.value = getStringPtr (String.valueOf(event.bottomMargin)); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - parentResult = OS.g_list_append(parentResult, attrPtr); + parentResult = OS.g_slist_append(parentResult, attrPtr); } if (event.indent != -1) { int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_INDENT)); attr.value = getStringPtr (String.valueOf(event.indent)); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - parentResult = OS.g_list_append(parentResult, attrPtr); + parentResult = OS.g_slist_append(parentResult, attrPtr); } if (event.justify) { int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_JUSTIFICATION)); attr.value = getStringPtr ("fill"); //$NON-NLS-1$ ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - parentResult = OS.g_list_append(parentResult, attrPtr); + parentResult = OS.g_slist_append(parentResult, attrPtr); } else if (event.alignment != -1) { int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_JUSTIFICATION)); @@ -592,7 +592,7 @@ class AccessibleObject { } attr.value = getStringPtr (str); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - parentResult = OS.g_list_append(parentResult, attrPtr); + parentResult = OS.g_slist_append(parentResult, attrPtr); } //TODO - tabStops if (event.attributes != null) { @@ -602,7 +602,7 @@ class AccessibleObject { attr.name = getStringPtr (event.attributes[i]); attr.value = getStringPtr (event.attributes[i + 1]); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - parentResult = OS.g_list_append(parentResult, attrPtr); + parentResult = OS.g_slist_append(parentResult, attrPtr); } } } @@ -1729,7 +1729,7 @@ class AccessibleObject { attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_RISE)); attr.value = getStringPtr (String.valueOf(style.rise)); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - result = OS.g_list_append(result, attrPtr); + result = OS.g_slist_append(result, attrPtr); } if (style.underline) { int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); @@ -1743,14 +1743,14 @@ class AccessibleObject { } attr.value = getStringPtr (str); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - result = OS.g_list_append(result, attrPtr); + result = OS.g_slist_append(result, attrPtr); } if (style.strikeout) { int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STRIKETHROUGH)); attr.value = getStringPtr ("1"); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - result = OS.g_list_append(result, attrPtr); + result = OS.g_slist_append(result, attrPtr); } Font font = style.font; if (font != null && !font.isDisposed()) { @@ -1760,37 +1760,37 @@ class AccessibleObject { attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_FAMILY_NAME)); attr.value = ATK.g_strdup (OS.pango_font_description_get_family (font.handle)); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - result = OS.g_list_append(result, attrPtr); + result = OS.g_slist_append(result, attrPtr); attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_SIZE)); attr.value = getStringPtr (String.valueOf (OS.pango_font_description_get_size(font.handle) / OS.PANGO_SCALE)); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - result = OS.g_list_append(result, attrPtr); + result = OS.g_slist_append(result, attrPtr); attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STYLE)); attr.value = ATK.g_strdup (ATK.atk_text_attribute_get_value(ATK.ATK_TEXT_ATTR_STYLE, OS.pango_font_description_get_style(font.handle))); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - result = OS.g_list_append(result, attrPtr); + result = OS.g_slist_append(result, attrPtr); attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_VARIANT)); attr.value = ATK.g_strdup (ATK.atk_text_attribute_get_value(ATK.ATK_TEXT_ATTR_VARIANT, OS.pango_font_description_get_variant(font.handle))); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - result = OS.g_list_append(result, attrPtr); + result = OS.g_slist_append(result, attrPtr); attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STRETCH)); attr.value = ATK.g_strdup (ATK.atk_text_attribute_get_value(ATK.ATK_TEXT_ATTR_STRETCH, OS.pango_font_description_get_stretch(font.handle))); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - result = OS.g_list_append(result, attrPtr); + result = OS.g_slist_append(result, attrPtr); attrPtr = OS.g_malloc(AtkAttribute.sizeof); attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_WEIGHT)); attr.value = getStringPtr (String.valueOf (OS.pango_font_description_get_weight(font.handle))); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - result = OS.g_list_append(result, attrPtr); + result = OS.g_slist_append(result, attrPtr); } Color color = style.foreground; if (color != null && !color.isDisposed()) { @@ -1798,7 +1798,7 @@ class AccessibleObject { attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_FG_COLOR)); attr.value = getStringPtr ((color.handle.red & 0xFFFF) + "," + (color.handle.blue & 0xFFFF) + "," + (color.handle.blue & 0xFFFF)); //$NON-NLS-1$ //$NON-NLS-2$ ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - result = OS.g_list_append(result, attrPtr); + result = OS.g_slist_append(result, attrPtr); } color = style.background; if (color != null && !color.isDisposed()) { @@ -1806,7 +1806,7 @@ class AccessibleObject { attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_BG_COLOR)); attr.value = getStringPtr ((color.handle.red & 0xFFFF) + "," + (color.handle.blue & 0xFFFF) + "," + (color.handle.blue & 0xFFFF)); //$NON-NLS-1$ //$NON-NLS-2$ ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - result = OS.g_list_append(result, attrPtr); + result = OS.g_slist_append(result, attrPtr); } } if (event.attributes != null) { @@ -1816,7 +1816,7 @@ class AccessibleObject { attr.name = getStringPtr (event.attributes[i]); attr.value = getStringPtr (event.attributes[i + 1]); ATK.memmove(attrPtr, attr, AtkAttribute.sizeof); - result = OS.g_list_append(result, attrPtr); + result = OS.g_slist_append(result, attrPtr); } } return result; 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 90076c413d..7e5b1172d5 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 @@ -4207,6 +4207,18 @@ fail: } #endif +#ifndef NO__1g_1slist_1append +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1slist_1append) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1slist_1append_FUNC); + rc = (jintLong)g_slist_append((GSList *)arg0, (gpointer)arg1); + OS_NATIVE_EXIT(env, that, _1g_1slist_1append_FUNC); + return rc; +} +#endif + #ifndef NO__1g_1slist_1data JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1slist_1data) (JNIEnv *env, jclass that, jintLong arg0) 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 7f522de72b..8e69234bca 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 = 1366; -int OS_nativeFunctionCallCount[1366]; +int OS_nativeFunctionCount = 1367; +int OS_nativeFunctionCallCount[1367]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -364,6 +364,7 @@ char * OS_nativeFunctionNames[] = { "_1g_1signal_1lookup", "_1g_1signal_1remove_1emission_1hook", "_1g_1signal_1stop_1emission_1by_1name", + "_1g_1slist_1append", "_1g_1slist_1data", "_1g_1slist_1free", "_1g_1slist_1length", 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 aa4c4d39b3..69ee398a2c 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 @@ -372,6 +372,7 @@ typedef enum { _1g_1signal_1lookup_FUNC, _1g_1signal_1remove_1emission_1hook_FUNC, _1g_1signal_1stop_1emission_1by_1name_FUNC, + _1g_1slist_1append_FUNC, _1g_1slist_1data_FUNC, _1g_1slist_1free_FUNC, _1g_1slist_1length_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 7bdd8a6710..34e91052c7 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 @@ -3046,6 +3046,19 @@ public static final boolean /*long*/ g_source_remove (int /*long*/ tag) { lock.unlock(); } } +/** + * @param list cast=(GSList *) + * @param data cast=(gpointer) + */ +public static final native int /*long*/ _g_slist_append(int /*long*/ list, int /*long*/ data); +public static final int /*long*/ g_slist_append(int /*long*/ list, int /*long*/ data) { + lock.lock(); + try { + return _g_slist_append(list, data); + } finally { + lock.unlock(); + } +} /** @param list cast=(GSList *) */ public static final native int /*long*/ _g_slist_data (int /*long*/ list); public static final int /*long*/ g_slist_data (int /*long*/ list) { |