Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 292138 - GenericHistoryView.showHistoryPageFor is called recursively
Summary: GenericHistoryView.showHistoryPageFor is called recursively
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows Vista
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform Team Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 330985 (view as bug list)
Depends on:
Blocks: 292140
  Show dependency tree
 
Reported: 2009-10-13 08:06 EDT by Stefan Lay CLA
Modified: 2020-07-25 14:40 EDT (History)
5 users (show)

See Also:


Attachments
Same as Comment #1, but better readable (long lines) (2.96 KB, text/plain)
2010-03-18 11:41 EDT, Mathias Kinzler CLA
no flags Details
Mathias' fix (1.48 KB, patch)
2010-07-27 06:23 EDT, Tomasz Zarna CLA
no flags Details | Diff
mylyn/context/zip (3.33 KB, application/octet-stream)
2010-07-27 06:23 EDT, Tomasz Zarna CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Lay CLA 2009-10-13 08:06:21 EDT
Build id: 20090920-1017

When the eclipse workbench is closed with an openend History View there is a problem after the next startup: During execution of GenericHistoryView.showHistoryPageFor() a propertyChangeEvent is fired which leads to a nested call of GenericHistoryView.showHistoryPageFor (see stacktrace below). This results in the fact that the page is created twice.

In our case (GitHistoryPage) this leads to a problem with the registration of the selection provider.

Is there a way to prevent the nested call?


Thread [main] (Suspended (breakpoint at line 291 in LocalHistoryPage))	
	LocalHistoryPage.createControl(Composite) line: 291	
	GenericHistoryView.createPage(IHistoryPageSource, Object) line: 857	
	GenericHistoryView.showHistoryPageFor(Object, boolean, boolean, IHistoryPageSource) line: 727	
	GenericHistoryView.showHistory(Object) line: 969	
	GenericHistoryView.editorActivated(IEditorPart) line: 892	
	GenericHistoryView$1.partActivated(IWorkbenchPart) line: 362	
	PartListenerList$1.run() line: 72	
	SafeRunner.run(ISafeRunnable) line: 42	
	Platform.run(ISafeRunnable) line: 888	
	PartListenerList.fireEvent(SafeRunnable, IPartListener, IWorkbenchPart, String) line: 57	
	PartListenerList.firePartActivated(IWorkbenchPart) line: 70	
	PartService.firePartActivated(IWorkbenchPartReference) line: 187	
	PartService.access$0(PartService, IWorkbenchPartReference) line: 177	
	PartService$PartActivated.fire() line: 100	
	PartService.processPartJobs() line: 161	
	PartService$PartListener.handleEvent(Event) line: 88	
	EventTable.sendEvent(Event) line: 84	
	Composite(Widget).sendEvent(Event) line: 1003	
	Composite(Widget).sendEvent(int, Event, boolean) line: 1027	
	Composite(Widget).sendEvent(int) line: 1008	
	Composite(Control).WM_SIZE(int, int) line: 4594	
	Composite(Scrollable).WM_SIZE(int, int) line: 285	
	Composite.WM_SIZE(int, int) line: 1523	
	Composite(Control).windowProc(int, int, int, int) line: 4019	
	Display.windowProc(int, int, int, int) line: 4589	
	OS.DefWindowProcW(int, int, int, int) line: not available [native method]	
	OS.DefWindowProc(int, int, int, int) line: 2404	
	Composite(Scrollable).callWindowProc(int, int, int, int) line: 80	
	Composite(Control).WM_WINDOWPOSCHANGED(int, int) line: 4751	
	Composite(Control).windowProc(int, int, int, int) line: 4029	
	Display.windowProc(int, int, int, int) line: 4589	
	OS.SetWindowPos(int, int, int, int, int, int, int) line: not available [native method]	
	Composite(Widget).SetWindowPos(int, int, int, int, int, int, int) line: 1316	
	Composite(Control).setBounds(int, int, int, int, int, boolean) line: 2781	
	Composite.setBounds(int, int, int, int, int, boolean) line: 893	
	Composite(Control).setBounds(int, int, int, int, int) line: 2742	
	Composite(Control).setBounds(int, int, int, int) line: 2738	
	Composite(Control).setBounds(Rectangle) line: 2805	
	ViewPane(LayoutPart).setBounds(Rectangle) line: 300	
	PresentablePart.setBounds(Rectangle) line: 170	
	PresentablePartFolder.layoutContent() line: 131	
	PresentablePartFolder.access$0(PresentablePartFolder) line: 127	
	PresentablePartFolder$1.controlMoved(ControlEvent) line: 56	
	TypedListener.handleEvent(Event) line: 211	
	EventTable.sendEvent(Event) line: 84	
	Composite(Widget).sendEvent(Event) line: 1003	
	Composite(Widget).sendEvent(int, Event, boolean) line: 1027	
	Composite(Widget).sendEvent(int) line: 1008	
	Composite(Control).WM_MOVE(int, int) line: 4477	
	Composite(Control).windowProc(int, int, int, int) line: 3994	
	Display.windowProc(int, int, int, int) line: 4589	
	OS.DefWindowProcW(int, int, int, int) line: not available [native method]	
	OS.DefWindowProc(int, int, int, int) line: 2404	
	Composite(Scrollable).callWindowProc(int, int, int, int) line: 80	
	Composite(Control).WM_WINDOWPOSCHANGED(int, int) line: 4751	
	Composite(Control).windowProc(int, int, int, int) line: 4029	
	Display.windowProc(int, int, int, int) line: 4602	
	OS.EndDeferWindowPos(int) line: not available [native method]	
	ViewForm(Composite).resizeChildren(boolean, WINDOWPOS[]) line: 823	
	ViewForm(Composite).resizeChildren() line: 789	
	ViewForm(Composite).setResizeChildren(boolean) line: 1013	
	ViewForm(Composite).updateLayout(boolean, boolean) line: 1146	
	ViewForm(Composite).layout(boolean, boolean) line: 625	
	ViewForm(Composite).layout(boolean) line: 583	
	ViewForm.setTopLeft(Control) line: 406	
	PaneFolder.setTopLeft(Control) line: 424	
	DefaultTabFolder.setSelectedInfo(PartInfo) line: 313	
	PresentablePartFolder.initTab(AbstractTabItem, IPresentablePart) line: 343	
	PresentablePartFolder.childPropertyChanged(IPresentablePart, int) line: 323	
	PresentablePartFolder.access$2(PresentablePartFolder, IPresentablePart, int) line: 303	
	PresentablePartFolder$3.propertyChanged(Object, int) line: 83	
	PresentablePart.firePropertyChange(int) line: 137	
	PresentablePart$1.propertyChanged(Object, int) line: 97	
	ViewPane(PartPane).firePropertyChange(int) line: 620	
	ViewPane(PartPane).propertyChanged(Object, int) line: 625	
	ViewReference(WorkbenchPartReference).immediateFirePropertyChange(int) line: 571	
	ViewReference(WorkbenchPartReference).firePropertyChange(int) line: 564	
	ViewReference(WorkbenchPartReference).deferEvents(boolean) line: 219	
	ViewReference(WorkbenchPartReference).refreshFromPart() line: 328	
	ViewReference(WorkbenchPartReference).partPropertyChanged(Object, int) line: 296	
	WorkbenchPartReference$2.propertyChanged(Object, int) line: 181	
	GenericHistoryView(WorkbenchPart).firePropertyChange(int) line: 129	
	GenericHistoryView(WorkbenchPart).internalSetContentDescription(String) line: 451	
	GenericHistoryView(WorkbenchPart).setContentDescription(String) line: 437	
	GenericHistoryView(ViewPart).setContentDescription(String) line: 154	
	GenericHistoryView.showHistoryPageFor(Object, boolean, boolean, IHistoryPageSource) line: 740	
	GenericHistoryView.showHistory(Object) line: 969	
	GenericHistoryView.editorActivated(IEditorPart) line: 892	
	GenericHistoryView$1.partActivated(IWorkbenchPart) line: 362	
	PartListenerList$1.run() line: 72	
	SafeRunner.run(ISafeRunnable) line: 42	
	Platform.run(ISafeRunnable) line: 888	
	PartListenerList.fireEvent(SafeRunnable, IPartListener, IWorkbenchPart, String) line: 57	
	PartListenerList.firePartActivated(IWorkbenchPart) line: 70	
	PartService.firePartActivated(IWorkbenchPartReference) line: 187	
	PartService.access$0(PartService, IWorkbenchPartReference) line: 177	
	PartService$PartActivated.fire() line: 100	
	PartService.processPartJobs() line: 161	
	PartService$PartListener.handleEvent(Event) line: 88	
	EventTable.sendEvent(Event) line: 84	
	Composite(Widget).sendEvent(Event) line: 1003	
	Composite(Widget).sendEvent(int, Event, boolean) line: 1027	
	Composite(Widget).sendEvent(int) line: 1008	
	Shell.setActiveControl(Control) line: 1404	
	StyledText(Control).sendFocusEvent(int) line: 2597	
	StyledText(Widget).wmSetFocus(int, int, int) line: 2282	
	StyledText(Control).WM_SETFOCUS(int, int) line: 4573	
	StyledText(Canvas).WM_SETFOCUS(int, int) line: 449	
	StyledText(Control).windowProc(int, int, int, int) line: 4014	
	StyledText(Canvas).windowProc(int, int, int, int) line: 342	
	Display.windowProc(int, int, int, int) line: 4589	
	OS.SetFocus(int) line: not available [native method]	
	StyledText(Control).forceFocus() line: 978	
	StyledText(Control).setSavedFocus() line: 3234	
	Shell(Decorations).restoreFocus() line: 809	
	Shell.open() line: 1220	
	WorkbenchWindow(Window).open() line: 797	
	WorkbenchWindow.open() line: 779	
	Workbench$62.runWithException() line: 3423	
	Workbench$62(StartupThreading$StartupRunnable).run() line: 31	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 134	
	Display.runAsyncMessages(boolean) line: 3855	
	Display.readAndDispatch() line: 3476	
	IDEWorkbenchAdvisor(WorkbenchAdvisor).openWindows() line: 803	
	Workbench$28.runWithException() line: 1384	
	Workbench$28(StartupThreading$StartupRunnable).run() line: 31	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 134	
	Display.runAsyncMessages(boolean) line: 3855	
	Display.readAndDispatch() line: 3476	
	Workbench.runUI() line: 2316	
	Workbench.access$4(Workbench) line: 2221	
	Workbench$5.run() line: 500	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 493	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 113	
	EclipseAppHandle.run(Object) line: 194	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 368	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	Main.invokeFramework(String[], URL[]) line: 559	
	Main.basicRun(String[]) line: 514	
	Main.run(String[]) line: 1311	
	Main.main(String[]) line: 1287
Comment 1 Mathias Kinzler CLA 2010-03-18 11:39:39 EDT
I have looked into this some more and found the following:

towards the end of method GenericHistoryView.showHistoryPageFor() the following happens:

		historyPage.setInput(object);
		((HistoryPage)historyPage).setHistoryView(this);
		setContentDescription(historyPage.getName());
		showPageRec(tempPageContainer);
		return historyPage;

I could resolve the issue by toggling the two lines like follows:

		historyPage.setInput(object);
		((HistoryPage)historyPage).setHistoryView(this);
-->		showPageRec(tempPageContainer);
-->		setContentDescription(historyPage.getName());
		return historyPage;

The actual reason for the nested creation call seems to be that the GenericHistoryView.editorActivated() is called while processing setContentDescription() (which fires PropertyChange events). During editorActivated(), the GenericHistoryView tries to show the history, too. Since getHistoryPage() still returns the previous history page (because showPageRec() has not yet been executed), the same history page is being created again.
Note that this only happens when you (re-)start the IDE and had an editor open and the history view with the content of this editor. Then when the editor is restored, this sequence occurs.
In order to clarify, I put some debug code into the above method:

		historyPage.setInput(object);
		((HistoryPage)historyPage).setHistoryView(this);
		System.err.println("getHistoryPage before setContentDescription: " + getHistoryPage().getClass().getName());
		System.err.println("Actual History Page before setContentDescription: " + historyPage.getClass().getName());
		setContentDescription(historyPage.getName());
		System.err.println("getHistoryPage after setContentDescription: " + getHistoryPage().getClass().getName());
		showPageRec(tempPageContainer);
		System.err.println("getHistoryPage after showPageRec: " + getHistoryPage().getClass().getName());
		return historyPage;
	}

The corresponding output ist then:


getHistoryPage before setContentDescription: org.eclipse.team.internal.ui.history.GenericHistoryViewDefaultPage
Actual History Page before setContentDescription: org.eclipse.egit.ui.internal.history.GitHistoryPage
getHistoryPage before setContentDescription: org.eclipse.team.internal.ui.history.GenericHistoryViewDefaultPage
Actual History Page before setContentDescription: org.eclipse.egit.ui.internal.history.GitHistoryPage
getHistoryPage after setContentDescription: org.eclipse.team.internal.ui.history.GenericHistoryViewDefaultPage
getHistoryPage after showPageRec: org.eclipse.egit.ui.internal.history.GitHistoryPage
getHistoryPage after setContentDescription: org.eclipse.egit.ui.internal.history.GitHistoryPage
getHistoryPage after showPageRec: org.eclipse.egit.ui.internal.history.GitHistoryPage

You can see the nested creation (the Actual History page is GitHistoryPage, while getHistoryPage still return GenericHistoryViewDefaultPage).

It would be great if someone could evaluate whether the above is the correct fix.
Comment 2 Mathias Kinzler CLA 2010-03-18 11:41:50 EDT
Created attachment 162426 [details]
Same as Comment #1, but better readable (long lines)
Comment 3 Tomasz Zarna CLA 2010-07-27 06:23:08 EDT
Created attachment 175299 [details]
Mathias' fix

After having a quick look this seems to be a proper fix, but I would like to take a look under the hood and see what's happening there. Please ping on the bug again in M2, since I may lose it from my radar.
Comment 4 Tomasz Zarna CLA 2010-07-27 06:23:13 EDT
Created attachment 175300 [details]
mylyn/context/zip
Comment 5 Mathias Kinzler CLA 2010-09-30 04:43:33 EDT
(In reply to comment #3)
> Created an attachment (id=175299) [details]
> Mathias' fix
> 
> After having a quick look this seems to be a proper fix, but I would like to
> take a look under the hood and see what's happening there. Please ping on the
> bug again in M2, since I may lose it from my radar.

Herewith pinging...
Comment 6 Mathias Kinzler CLA 2010-11-05 05:32:24 EDT
Any update on this, please?
Comment 7 Mathias Kinzler CLA 2010-11-22 09:46:17 EST
(In reply to comment #3)
> Created an attachment (id=175299) [details]
> Mathias' fix
> 
> After having a quick look this seems to be a proper fix, but I would like to
> take a look under the hood and see what's happening there. Please ping on the
> bug again in M2, since I may lose it from my radar.

Could someone please provide an update?
Is there anything we can help with?

Best regards
Mathias
Comment 8 Mathias Kinzler CLA 2010-11-25 04:52:25 EST
*** Bug 330985 has been marked as a duplicate of this bug. ***
Comment 9 Mathias Kinzler CLA 2010-11-25 04:53:52 EST
(In reply to comment #8)
> *** Bug 330985 has been marked as a duplicate of this bug. ***

This bug describes another symptom of the same issue: when hovering over the page, a busy cursor is shown. I have tested this and the proposed patch solves this issue as well.
Comment 10 Robin Rosenberg CLA 2013-01-08 18:35:15 EST
Status?
Comment 11 Malgorzata Janczarska CLA 2013-01-09 05:42:23 EST
I will take this bug over from Tomasz who is no longer contributing on daily basis.
I can see that GenericHistoryView has been rewritten since attachment 175299 [details] was created and the new version doesn't contains the problems corrected by attachment 175299 [details].
Could you verify if the bug is still present in the current stream?
Comment 12 Robin Stocker CLA 2013-09-27 09:37:02 EDT
This looks fixed, I could not reproduce the problem in bug 292140.
Comment 13 Eclipse Genie CLA 2020-07-25 14:40:50 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.