This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
ToggleBreakpointActionProvider.doAction() in both jpda and the native debugger uses the "current line" to set a bpt on. I was worried that this might be problematic: what if the current line isn't where you toggled? Turns out the act of clicking in the gutter moves the current line (cursor). However, I just observed one instance where the cursor was on a different line from where I was clicking in the glyph gutter and the bpt ended up at the line with the cursor not where I was clicking for a bpt. Could I please ask someone to review the data paths in the editor and double check that the current line is set before the action is delivered to the debugger.
This is a request for the editor I believe... Debugger just registeres an action into text/x-java/GlyphGutterAction, the call comes from the Editor...
I've tried to reproduce the issue but I was not successful. Anyway I've tracked the code and ToggleBreakpointActionProvider calls EditorContextImpl.getCurrentLineNumber(). However for some reason it's not done in AWT (stack attached). IMHO the line number should be grabbed in AWT to prevent symptoms of this issue. Reassigning to debuggerjpda for further evaluation.
Created attachment 37228 [details] Stack of calling of the EditorContextImpl.getCurrentLineNumber()
The important thing is that the line number be set by the editor before the callback registered by the debugger is called. Can you "prove" that these happen serially?
There are associated issue #90147 and issue #90142. It's true that EditorContextImpl.getCurrentLineNumber() should be called in AWT as a direct response to the mouse click. Currently org.netbeans.modules.debugger.ui.actions.DebuggerAction reschedules that into a RequestProcessor. We likely need to modify ToggleBreakpointActionProvider and override postAction().
Changing TM for open issues.
This was already fixed - ToggleBreakpointActionProvider overrides postAction(). See also related issue #172431.