Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 351916

Summary: StyledText crash in OS.ATSUGetTextHighlight
Product: [Eclipse Project] Platform Reporter: Fan Peng <pfancdl>
Component: SWTAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: eclipse.felipe, kleind, linyunz, mukund, pfancdl, pwebster, Silenio_Quarti
Version: 3.6.2   
Target Milestone: 3.8 M1   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Crash sample application
none
Stack trace
none
fix none

Description Fan Peng CLA 2011-07-13 03:46:35 EDT
Build Identifier: Eclipse carbon 3.5.2 20100218-1602

StyledText crash in TextLayout.getBounds in OS.ATSUGetTextHighlight in Eclipse Carbon.

Reproducible: Always

Steps to Reproduce:
1.Run the sample st_screenshot_crash in Eclipse carbon 3.5.2 20100218-1602.
2.Select ment File > getText.A black sprite shell will be showed.The sprite shell will move to the cursor's current location every 2.5 seconds, implemented by an UIJob.
3.Open an java file in Eclipse.Move the cursor quickly in the java file editor.Try to select and drag an section of text.Once you have drag an section of text successfully, hold the mouse left button, don't move the mouse, wait 2.5 seconds, the sprite shell will move to the cursor's current location, then release the button and press the left button again to dispose the sprite shell.
4.Input an space in StyledText, it will crashed.
Comment 1 Fan Peng CLA 2011-07-13 03:48:26 EDT
Created attachment 199545 [details]
Crash sample application
Comment 2 Fan Peng CLA 2011-07-13 03:48:58 EDT
Created attachment 199546 [details]
Stack trace
Comment 3 Fan Peng CLA 2011-07-13 03:49:52 EDT
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.eclipse.swt.internal.carbon.OS.ATSUGetTextHighlight(IIIIII)I+0
j  org.eclipse.swt.graphics.TextLayout.getBounds(II)Lorg/eclipse/swt/graphics/Rectangle;+383
j  org.eclipse.swt.custom.StyledText.getBoundsAtOffset(I)Lorg/eclipse/swt/graphics/Rectangle;+63
j  org.eclipse.swt.custom.StyledText.showCaret()V+5
j  org.eclipse.swt.custom.StyledText.modifyContent(Lorg/eclipse/swt/widgets/Event;Z)V+320
j  org.eclipse.swt.custom.StyledText.sendKeyEvent(Lorg/eclipse/swt/widgets/Event;)V+10
j  org.eclipse.swt.custom.StyledText.doContent(C)V+257
j  org.eclipse.swt.custom.StyledText.handleKey(Lorg/eclipse/swt/widgets/Event;)V+270
j  org.eclipse.swt.custom.StyledText.handleKeyDown(Lorg/eclipse/swt/widgets/Event;)V+153
j  org.eclipse.swt.custom.StyledText$7.handleEvent(Lorg/eclipse/swt/widgets/Event;)V+104
j  org.eclipse.swt.widgets.EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;)V+214
j  org.eclipse.swt.widgets.Widget.sendEvent(Lorg/eclipse/swt/widgets/Event;)V+25
j  org.eclipse.swt.widgets.Widget.sendEvent(ILorg/eclipse/swt/widgets/Event;Z)V+73
j  org.eclipse.swt.widgets.Widget.sendEvent(ILorg/eclipse/swt/widgets/Event;)V+4
j  org.eclipse.swt.widgets.Widget.sendKeyEvent(ILorg/eclipse/swt/widgets/Event;)Z+3
j  org.eclipse.swt.widgets.Widget.sendKeyEvent(II)Z+255
j  org.eclipse.swt.widgets.Control.kEventUnicodeKeyPressed(III)I+31
j  org.eclipse.swt.widgets.Composite.kEventUnicodeKeyPressed(III)I+4
j  org.eclipse.swt.widgets.Control.kEventTextInputUnicodeForKeyEvent(III)I+137
j  org.eclipse.swt.widgets.Canvas.kEventTextInputUnicodeForKeyEvent(III)I+4


Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   com.apple.QD                  	0x912b5ff2 CheckPortPictureRecording + 20
1   com.apple.QD                  	0x912d613b InternalStdLine + 126
2   com.apple.QD                  	0x912e0bcd InternalLineTo + 32
3   com.apple.QD                  	0x912e0c77 LineTo + 63
4   com.apple.QD                  	0x9130ded6 TTextLineLayout::GetTextHighlight(long, long, unsigned long, unsigned long, OpaqueRgnHandle*) + 704
5   com.apple.QD                  	0x912fbb8d ATSUGetTextHighlight + 140
6   libswt-pi-carbon-3659.jnilib  	0x36f1ae82 Java_org_eclipse_swt_internal_carbon_OS_ATSUGetTextHighlight + 60
Comment 4 Felipe Heidrich CLA 2011-07-21 14:03:33 EDT
I can reproduce this but not reliably (some times it crashes, sometimes it doesn't). But I always get this warning everytime I click on the sprite:
Thu Jul 21 14:15:09 myhost.ottawa.ibm.com java[961] <Error>: kCGErrorIllegalArgument: CGSGetWindowBounds: NULL window
Thu Jul 21 14:15:09 myhost.ottawa.ibm.com java[961] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Comment 5 Silenio Quarti CLA 2011-07-21 16:28:33 EDT
Created attachment 200120 [details]
fix
Comment 7 Fan Peng CLA 2011-07-31 23:15:54 EDT
Thanks!
It has been fixed!