From c9f7838af1e54e39107b4e5302048b7cebef9023 Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Thu, 12 Jul 2012 09:42:39 -0400 Subject: Bug 376560 - Crash when starting on SUSE or some RHEL4 - Comment#11 --- .../gtk/org/eclipse/swt/graphics/TextLayout.java | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java index c0f4ff32a7..67695a3d5d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/TextLayout.java @@ -240,12 +240,14 @@ void computeRuns () { if (style.underlineColor != null) { GdkColor fg = style.underlineColor.handle; attr = OS.pango_attr_underline_color_new(fg.red, fg.green, fg.blue); - OS.memmove(attribute, attr, PangoAttribute.sizeof); - attribute.start_index = byteStart; - attribute.end_index = byteEnd; - OS.memmove(attr, attribute, PangoAttribute.sizeof); - OS.pango_attr_list_insert(attrList, attr); - OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr)); + if (attr != 0) { + OS.memmove(attribute, attr, PangoAttribute.sizeof); + attribute.start_index = byteStart; + attribute.end_index = byteEnd; + OS.memmove(attr, attribute, PangoAttribute.sizeof); + OS.pango_attr_list_insert(attrList, attr); + OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr)); + } } } if (style.strikeout) { @@ -259,12 +261,14 @@ void computeRuns () { if (style.strikeoutColor != null) { GdkColor fg = style.strikeoutColor.handle; attr = OS.pango_attr_strikethrough_color_new(fg.red, fg.green, fg.blue); - OS.memmove(attribute, attr, PangoAttribute.sizeof); - attribute.start_index = byteStart; - attribute.end_index = byteEnd; - OS.memmove(attr, attribute, PangoAttribute.sizeof); - OS.pango_attr_list_insert(attrList, attr); - OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr)); + if (attr != 0) { + OS.memmove(attribute, attr, PangoAttribute.sizeof); + attribute.start_index = byteStart; + attribute.end_index = byteEnd; + OS.memmove(attr, attribute, PangoAttribute.sizeof); + OS.pango_attr_list_insert(attrList, attr); + OS.pango_attr_list_insert(selAttrList, OS.pango_attribute_copy(attr)); + } } } Color foreground = style.foreground; -- cgit