diff options
author | Bogdan Gheorghe <gheorghe@ca.ibm.com> | 2011-08-05 14:11:12 -0400 |
---|---|---|
committer | Bogdan Gheorghe <gheorghe@ca.ibm.com> | 2011-08-05 14:11:12 -0400 |
commit | ea9da011382c7ec93bcd569f034b6dd753cfdd96 (patch) | |
tree | 4bf50ff6736b87f79587e8907032c59dce53b405 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java | |
parent | beb3230a14d718993438b762d3e460dbe17629f9 (diff) | |
download | eclipse.platform.swt-ea9da011382c7ec93bcd569f034b6dd753cfdd96.tar.gz eclipse.platform.swt-ea9da011382c7ec93bcd569f034b6dd753cfdd96.tar.xz eclipse.platform.swt-ea9da011382c7ec93bcd569f034b6dd753cfdd96.zip |
Bug 345979 - Helios Crash on Linux
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java index 8ce0cde2ba..d0a81f5582 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java @@ -875,13 +875,17 @@ public void setText (String string) { char [] chars = fixMnemonic (string); byte [] buffer = Converter.wcsToMbcs (null, chars, true); int /*long*/ label = OS.gtk_bin_get_child (handle); - OS.gtk_label_set_text_with_mnemonic (label, buffer); - buffer = Converter.wcsToMbcs (null, accelString, true); - int /*long*/ ptr = OS.g_malloc (buffer.length); - OS.memmove (ptr, buffer, buffer.length); - int /*long*/ oldPtr = OS.GTK_ACCEL_LABEL_GET_ACCEL_STRING (label); - OS.GTK_ACCEL_LABEL_SET_ACCEL_STRING (label, ptr); - if (oldPtr != 0) OS.g_free (oldPtr); + if (label != 0 && OS.GTK_IS_LABEL(label)) { + OS.gtk_label_set_text_with_mnemonic (label, buffer); + buffer = Converter.wcsToMbcs (null, accelString, true); + int /*long*/ ptr = OS.g_malloc (buffer.length); + OS.memmove (ptr, buffer, buffer.length); + if (OS.GTK_IS_ACCEL_LABEL(label)) { + int /*long*/ oldPtr = OS.GTK_ACCEL_LABEL_GET_ACCEL_STRING (label); + OS.GTK_ACCEL_LABEL_SET_ACCEL_STRING (label, ptr); + if (oldPtr != 0) OS.g_free (oldPtr); + } + } } void updateAccelerator (int /*long*/ accelGroup, boolean add) { |