Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331932 - 'Console' view disregards IHandlerService's deactivateHandler(IHandlerActivation) javadoc and passes in null
Summary: 'Console' view disregards IHandlerService's deactivateHandler(IHandlerActivat...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Pawel Piech CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-06 13:30 EST by Remy Suen CLA
Modified: 2011-01-24 14:34 EST (History)
3 users (show)

See Also:


Attachments
Proposed fix. (858 bytes, patch)
2010-12-07 12:51 EST, Pawel Piech CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2010-12-06 13:30:58 EST
1. Put a breakpoint in org.eclipse.ui.internal.handlers.SlaveHandlerService's deactivateHandler(IHandlerActivation) for the parameter begin null.
2. Show the 'Console' view if you don't have it up already.
3. Prepare two hello world applications.
4. Put a breakpoint in one of them.
5. Debug the first one. The breakpoint is hit.
6. Now run the second one. Your outer's breakpoint will be hit.

NestableHandlerService(SlaveHandlerService).deactivateHandler(IHandlerActivation) line: 191	
	ProcessConsolePageParticipant.deactivated() line: 254	
	ConsoleView$8.run() line: 740	
	SafeRunner.run(ISafeRunnable) line: 42	
	ConsoleView.deactivateParticipants(IConsole) line: 738	
	ConsoleView.showPageRec(PageBookView$PageRec) line: 177	
	ConsoleView(PageBookView).partActivated(IWorkbenchPart) line: 756	
	ConsoleView$4.run() line: 404	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 134	
	Display.runAsyncMessages(boolean) line: 4059	
	Display.readAndDispatch() line: 3678	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2640	
	Workbench.runUI() line: 2604	
	Workbench.access$4(Workbench) line: 2438	
	Workbench$7.run() line: 671	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 664	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149
Comment 1 Remy Suen CLA 2010-12-06 13:47:45 EST
Note that you must _not_ activate the 'Console' view while you are performing steps 4 to 6.
Comment 2 Pawel Piech CLA 2010-12-07 12:51:38 EST
Created attachment 184738 [details]
Proposed fix.

I think there's just a test missing.  It solves the problem for me, I'm just not sure if it will have any bad side effects.
Comment 3 Pawel Piech CLA 2010-12-07 12:53:20 EST
Michael, do you see any case where this test would cause deactivate not to be called properly?
Comment 4 Remy Suen CLA 2010-12-07 12:59:17 EST
If you guys opt to put the null check into ProcessConsolePageParticipant _directly_ (like JavaStackTracePageParticipant), please also make sure you add a check for the 'fActivatedContext' field since that is also violating API rules by calling IContextService's deactivateContext(IContextActivation) method with a null parameter.
Comment 5 Pawel Piech CLA 2010-12-07 13:55:29 EST
(In reply to comment #4)
> If you guys opt to put the null check into ProcessConsolePageParticipant ...
Thanks Remy.  A null check in ProcessConsolePageParticipant is a good idea as a precaution, though the root problem is that deacivate() is called even though activate() was not.
Comment 6 Michael Rennie CLA 2010-12-08 11:00:53 EST
(In reply to comment #3)
> Michael, do you see any case where this test would cause deactivate not to be
> called properly?

It should be fine, I don't know of any code path that would have the part deactivated (fActive == false) and then try to show it.
Comment 7 Pawel Piech CLA 2011-01-24 14:34:06 EST
Committed the fix.
Comment 8 Pawel Piech CLA 2011-01-24 14:34:53 EST
(In reply to comment #6)
> It should be fine, I don't know of any code path that would have the part
> deactivated (fActive == false) and then try to show it.

Already reviewed.