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

Bug 352315

Summary: NPE in BreakpointManager.removeBreakpointListener() during shutdown
Product: [Eclipse Project] Platform Reporter: Mirko Seifert <mirko.seifert>
Component: DebugAssignee: Pawel Piech <pawel.1.piech>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, Michael_Rennie, pawel.1.piech
Version: 3.7Flags: Michael_Rennie: review+
Target Milestone: 3.8 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed simple fix. none

Description Mirko Seifert CLA 2011-07-18 04:41:43 EDT
Build Identifier: I20110613-1736

If removeBreakpointListener() is called after the BreakpointManager has been shut down by the DebugPlugin, a NPE is thrown, because some fields in BreakpointManager are set to null in shutdown(). 

The methods to add/remove listeners should either check whether the field are null and do nothing in this case, or the method DebugPlugin.isShuttingDown() should be public to allow clients to check whether a shut down is currently going on. In the latter case, client can avoid calls to the add/remove listener methods.

Reproducible: Always
Comment 1 Pawel Piech CLA 2011-07-20 12:31:06 EDT
Created attachment 200026 [details]
Proposed simple fix.
Comment 2 Pawel Piech CLA 2011-07-20 12:33:42 EDT
It seems that the most correct thing to do would be to add another synchronization object that is set at shutdown and checked before every listener add/remove.  This seems like a lot of fluff for the edge case.  Instead I think we can just clear the lists instead of setting them to null.

Mike, do you agree?
Comment 3 Michael Rennie CLA 2011-08-08 12:26:28 EDT
Makes sense.
Comment 4 Michael Rennie CLA 2011-08-08 13:54:48 EDT
Applied a version of the patch that does not have a compile error in it to HEAD.
Comment 5 Curtis Windatt CLA 2011-09-13 17:19:13 EDT
Verified in I20110912-2126