Project: SWT
Bug 279676 IllegalStateException in ProjectionMapping toImageLine
Reported: 2009-06-09 15:00:35 | Status: resolved fixed

Build ID: M20090211-1700 Steps To Reproduce: In our editor we implement documentChanged where we new up a WorkspaceModifyOperation to update markers and run it passing in the IProgressMonitor returned from AbstractTextEditor.getProgressMonitor(). This code works fine on all platforms, but mac users who upgrade their OS to 10.5.7 experience the following errors and the editor becomes useless. Mac users on 10.5.6 do not see the errors. Strangely, if we pass in null for the progress monitor when we call WorkspaceModifyOperation.run(), the errors do not happen, even on 10.5.7. More information: java.lang.IllegalStateException at org.eclipse.jface.text.projection.ProjectionMapping.toImageLine(ProjectionMapping.java:480) at org.eclipse.jface.text.TextViewer.modelLine2WidgetLine(TextViewer.java:4905) at org.eclipse.jface.text.JFaceTextUtil.modelLineToWidgetLine(JFaceTextUtil.java:220) at org.eclipse.jface.internal.text.source.DiffPainter.paintLine(DiffPainter.java:220) at org.eclipse.jface.internal.text.source.DiffPainter.paint(DiffPainter.java:158) at org.eclipse.jface.text.source.LineNumberChangeRulerColumn.doPaint(LineNumberChangeRulerColumn.java:190) at org.eclipse.jface.text.source.LineNumberRulerColumn.doubleBufferPaint(LineNumberRulerColumn.java:692) at org.eclipse.jface.text.source.LineNumberRulerColumn.access$10(LineNumberRulerColumn.java:662) at org.eclipse.jface.text.source.LineNumberRulerColumn$5.paintControl(LineNumberRulerColumn.java:606) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:217) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1561) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1585) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1570) at org.eclipse.swt.widgets.Control.drawWidget(Control.java:850) at org.eclipse.swt.widgets.Canvas.drawWidget(Canvas.java:114) at org.eclipse.swt.widgets.Widget.kEventControlDraw(Widget.java:1069) at org.eclipse.swt.widgets.Canvas.kEventControlDraw(Canvas.java:191) at org.eclipse.swt.widgets.Widget.controlProc(Widget.java:370) at org.eclipse.swt.widgets.Display.controlProc(Display.java:862) at org.eclipse.swt.internal.carbon.OS.ReceiveNextEvent(Native Method) at org.eclipse.swt.widgets.Display.runEventLoopTimers(Display.java:3500) at org.eclipse.swt.widgets.ProgressBar.setSelection(ProgressBar.java:243) at org.eclipse.jface.dialogs.ProgressIndicator.done(ProgressIndicator.java:110) at org.eclipse.jface.dialogs.ProgressIndicator.beginTask(ProgressIndicator.java:92) at org.eclipse.jface.action.StatusLine.beginTask(StatusLine.java:349) at org.eclipse.jface.action.StatusLineManager$1.beginTask(StatusLineManager.java:157) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1791) at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:116) at com.rsi.idldt.proeditor.ProEditor.documentChanged(ProEditor.java:2282) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:739) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:712) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:697) at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:762) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1157) at org.eclipse.core.internal.filebuffers.SynchronizableDocument.replace(SynchronizableDocument.java:151) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1176) at org.eclipse.core.internal.filebuffers.SynchronizableDocument.replace(SynchronizableDocument.java:137) at org.eclipse.jface.text.projection.ProjectionTextStore.replace(ProjectionTextStore.java:111) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1150) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1176) at org.eclipse.jface.text.projection.ProjectionDocument.replace(ProjectionDocument.java:631) at org.eclipse.jface.text.DefaultDocumentAdapter.replaceTextRange(DefaultDocumentAdapter.java:248) at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:5876) at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:6631) at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2186) at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5145) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5170) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4873) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1561) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1585) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1570) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1622) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1617) at org.eclipse.swt.widgets.Control.kEventUnicodeKeyPressed(Control.java:2292) at org.eclipse.swt.widgets.Composite.kEventUnicodeKeyPressed(Composite.java:586) at org.eclipse.swt.widgets.Control.kEventTextInputUnicodeForKeyEvent(Control.java:2254) at org.eclipse.swt.widgets.Canvas.kEventTextInputUnicodeForKeyEvent(Canvas.java:232) at org.eclipse.swt.widgets.Widget.textInputProc(Widget.java:1995) at org.eclipse.swt.widgets.Display.textInputProc(Display.java:3970) at org.eclipse.swt.internal.carbon.OS.SendEventToEventTarget(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3051) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236) org.eclipse.core.runtime.AssertionFailedException: assertion failed: at org.eclipse.core.runtime.Assert.isTrue(Assert.java:111) at org.eclipse.core.runtime.Assert.isTrue(Assert.java:97) at org.eclipse.jface.text.Position.<init>(Position.java:62) at org.eclipse.jface.text.AbstractDocument.getPositions(AbstractDocument.java:1704) at org.eclipse.core.internal.filebuffers.SynchronizableDocument.getPositions(SynchronizableDocument.java:234) at org.eclipse.jface.text.source.AnnotationModel.getRegionAnnotationIterator(AnnotationModel.java:739) at org.eclipse.jface.text.source.AnnotationModel.getAnnotationIterator(AnnotationModel.java:701) at org.eclipse.jface.text.source.AnnotationRulerColumn.doPaint1(AnnotationRulerColumn.java:704) at org.eclipse.jface.text.source.AnnotationRulerColumn.doubleBufferPaint(AnnotationRulerColumn.java:518) at org.eclipse.jface.text.source.AnnotationRulerColumn.access$3(AnnotationRulerColumn.java:494) at org.eclipse.jface.text.source.AnnotationRulerColumn$1.paintControl(AnnotationRulerColumn.java:280) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:217) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1561) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1585) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1570) at org.eclipse.swt.widgets.Control.drawWidget(Control.java:850) at org.eclipse.swt.widgets.Canvas.drawWidget(Canvas.java:114) at org.eclipse.swt.widgets.Widget.kEventControlDraw(Widget.java:1069) at org.eclipse.swt.widgets.Canvas.kEventControlDraw(Canvas.java:191) at org.eclipse.swt.widgets.Widget.controlProc(Widget.java:370) at org.eclipse.swt.widgets.Display.controlProc(Display.java:862) at org.eclipse.swt.internal.carbon.OS.ReceiveNextEvent(Native Method) at org.eclipse.swt.widgets.Display.runEventLoopTimers(Display.java:3500) at org.eclipse.swt.widgets.ProgressBar.setSelection(ProgressBar.java:243) at org.eclipse.jface.dialogs.ProgressIndicator.done(ProgressIndicator.java:110) at org.eclipse.jface.dialogs.ProgressIndicator.beginTask(ProgressIndicator.java:92) at org.eclipse.jface.action.StatusLine.beginTask(StatusLine.java:349) at org.eclipse.jface.action.StatusLineManager$1.beginTask(StatusLineManager.java:157) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1791) at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:116) at com.rsi.idldt.proeditor.ProEditor.documentChanged(ProEditor.java:2282) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:739) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:712) at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:697) at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:762) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1157) at org.eclipse.core.internal.filebuffers.SynchronizableDocument.replace(SynchronizableDocument.java:151) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1176) at org.eclipse.core.internal.filebuffers.SynchronizableDocument.replace(SynchronizableDocument.java:137) at org.eclipse.jface.text.projection.ProjectionTextStore.replace(ProjectionTextStore.java:111) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1150) at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1176) at org.eclipse.jface.text.projection.ProjectionDocument.replace(ProjectionDocument.java:631) at org.eclipse.jface.text.DefaultDocumentAdapter.replaceTextRange(DefaultDocumentAdapter.java:248) at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:5876) at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:6631) at org.eclipse.swt.custom.StyledText.doBackspace(StyledText.java:2128) at org.eclipse.swt.custom.StyledText.invokeAction(StyledText.java:5764) at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5149) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5170) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4873) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1561) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1585) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1570) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1622) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1617) at org.eclipse.swt.widgets.Control.kEventUnicodeKeyPressed(Control.java:2292) at org.eclipse.swt.widgets.Composite.kEventUnicodeKeyPressed(Composite.java:586) at org.eclipse.swt.widgets.Control.kEventTextInputUnicodeForKeyEvent(Control.java:2254) at org.eclipse.swt.widgets.Canvas.kEventTextInputUnicodeForKeyEvent(Canvas.java:232) at org.eclipse.swt.widgets.Widget.textInputProc(Widget.java:1995) at org.eclipse.swt.widgets.Display.textInputProc(Display.java:3970) at org.eclipse.swt.internal.carbon.OS.SendEventToEventTarget(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3051) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236)

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/ProgressBar.java