Bug 498907 - IllegalStateException in ProjectionMapping.toImageLine
Summary: IllegalStateException in ProjectionMapping.toImageLine
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.6   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: 4.6.2   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on: 499010 499017
Blocks:
  Show dependency tree
 
Reported: 2016-07-29 22:47 EDT by Sergey Prigogin CLA
Modified: 2016-11-14 00:04 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Prigogin CLA 2016-07-29 22:47:21 EDT
Happens from time to time when editing Java code:

java.lang.IllegalStateException: startLine (169) does not match endLine (170)
	at org.eclipse.jface.text.projection.ProjectionMapping.toImageLine(ProjectionMapping.java:459)
	at org.eclipse.jface.text.TextViewer.modelLine2WidgetLine(TextViewer.java:5123)
	at org.eclipse.jface.text.source.MatchingCharacterPainter.handleDrawRequest(MatchingCharacterPainter.java:212)
	at org.eclipse.jface.text.source.MatchingCharacterPainter.paintControl(MatchingCharacterPainter.java:182)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:231)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5216)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1366)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1349)
	at org.eclipse.swt.widgets.Control.gtk_expose_event(Control.java:3382)
	at org.eclipse.swt.widgets.Composite.gtk_expose_event(Composite.java:771)
	at org.eclipse.swt.widgets.Canvas.gtk_expose_event(Canvas.java:182)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1993)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5815)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5487)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:9510)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1272)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_iteration_do(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_iteration_do(OS.java:9500)
	at org.eclipse.swt.widgets.ProgressBar.updateBar(ProgressBar.java:304)
	at org.eclipse.swt.widgets.ProgressBar.setMinimum(ProgressBar.java:240)
	at org.eclipse.jface.dialogs.ProgressIndicator.done(ProgressIndicator.java:108)
	at org.eclipse.jface.action.StatusLine.done(StatusLine.java:396)
	at org.eclipse.jface.action.StatusLineManager$1.done(StatusLineManager.java:159)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.installOccurrencesFinder(JavaEditor.java:3376)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorHighlightingSynchronizer.left(EditorHighlightingSynchronizer.java:52)
	at org.eclipse.jface.text.link.LinkedModeModel.exit(LinkedModeModel.java:341)
	at org.eclipse.jface.text.link.LinkedModeModel$DocumentListener.documentChanged(LinkedModeModel.java:202)
	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:743)
	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:712)
	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:696)
	at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:770)
	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1101)
	at org.eclipse.core.internal.filebuffers.SynchronizableDocument.replace(SynchronizableDocument.java:173)
	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1119)
	at org.eclipse.core.internal.filebuffers.SynchronizableDocument.replace(SynchronizableDocument.java:161)
	at org.eclipse.jface.text.projection.ProjectionTextStore.replace(ProjectionTextStore.java:103)
	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1094)
	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1119)
	at org.eclipse.jface.text.projection.ProjectionDocument.replace(ProjectionDocument.java:625)
	at org.eclipse.jface.text.DefaultDocumentAdapter.replaceTextRange(DefaultDocumentAdapter.java:233)
	at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7350)
	at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:8201)
	at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2527)
	at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5999)
	at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:6030)
	at org.eclipse.swt.custom.StyledText.lambda$1(StyledText.java:5728)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5216)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1340)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1366)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1349)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1378)
	at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:764)
	at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3457)
	at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:801)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2000)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5815)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5487)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:9510)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1272)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2447)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4138)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:692)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)

Results in temporary disappearing caret.

Did not happen in Eclipse 4.5.
Comment 1 Eclipse Genie CLA 2016-07-29 23:10:46 EDT
New Gerrit change created: https://git.eclipse.org/r/78204
Comment 2 Sergey Prigogin CLA 2016-07-29 23:11:49 EDT
The change https://git.eclipse.org/r/78204 does not fix the root cause of the bug but makes the symptoms less severe.
Comment 3 Dani Megert CLA 2016-08-03 10:07:49 EDT
Can you provide steps or a test case?
Comment 4 Sergey Prigogin CLA 2016-08-03 10:23:49 EDT
(In reply to Dani Megert from comment #3)
> Can you provide steps or a test case?

Not really. The problem happens from time to time and has been reported by multiple people but the steps to reproduce it are not clear.
Comment 5 Dani Megert CLA 2016-08-03 10:45:18 EDT
(In reply to Sergey Prigogin from comment #4)
> (In reply to Dani Megert from comment #3)
> > Can you provide steps or a test case?
> 
> Not really. The problem happens from time to time and has been reported by
> multiple people but the steps to reproduce it are not clear.

Does it happen in different editors, or just e.g. in the Java editor?
Comment 6 Sergey Prigogin CLA 2016-08-03 14:00:32 EDT
(In reply to Dani Megert from comment #5)
> Does it happen in different editors, or just e.g. in the Java editor?

Hasn't been reported in editors other than Java.
Comment 7 Sergey Prigogin CLA 2016-11-01 16:42:40 EDT
Judging by the call stack this problem may have the same root cause as bug 506113 - the change https://git.eclipse.org/r/#/c/79134/3/bundles/org.eclipse.swt/Eclipse+SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
Comment 8 Eclipse Genie CLA 2016-11-01 16:57:40 EDT
New Gerrit change created: https://git.eclipse.org/r/84297
Comment 10 Dani Megert CLA 2016-11-02 13:25:07 EDT
(In reply to Eclipse Genie from comment #9)
> Gerrit change https://git.eclipse.org/r/84297 was merged to
> [R4_6_maintenance].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=58541c443c1a81178e859157dcd567915728f643
> 

Why is this only fixed in R4_6_maintenance? Note that our process is to fix it in master and only consider a backport when it was working for some weeks there.
Comment 11 Sergey Prigogin CLA 2016-11-02 14:29:26 EDT
(In reply to Dani Megert from comment #10)
> Why is this only fixed in R4_6_maintenance? Note that our process is to fix
> it in master and only consider a backport when it was working for some weeks
> there.

As explained in the commit, this change is intended for the 4.6 maintenance stream only. The 4.7 development stream contains a more general protection
mechanism guarding against exceptions in SWT event listeners. That protection mechanism is based on bug 499010 and cannot be backported to R4_6_maintenance branch due to dependency on JRE 1.8.

Please notice that the bug is not fixed. https://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=58541c443c1a81178e859157dcd567915728f643 prevents caret from disappearing but doesn't fix the underlying issue.
Comment 12 Dani Megert CLA 2016-11-02 16:41:34 EDT
(In reply to Sergey Prigogin from comment #11)
> As explained in the commit, 

That's the pity of having Gerrit and Bugzilla - comments are split between two systems.
Comment 13 Sergey Prigogin CLA 2016-11-14 00:04:38 EST
The problem doesn't seem to happen anymore after the change  https://git.eclipse.org/r/#/c/79134/3/bundles/org.eclipse.swt/Eclipse+SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java has been reverted.