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.
I'm using the Trivial implementation of DialogDisplayer and I've noticed that option2Button leaks listeners. The problem happens if 'option instanceof AbstractButton' when a listener (created by makeListener(...)) is added and re-added without ever being removed. See my attached patch for a possible way to fix this.
Created attachment 103926 [details] Remove (duplicate) option listeners
i did some profiling but there was no memory leak. can you pls provide some sample code demonstrating how you use the Trivial dialog displayer? thanks
StandardDialog uses NotifyDescriptor.getOptions and does: buttonPanel.add(option2Button(options[i], nd, makeListener(options[i]), rp)); and if "option instanceof AbstractButton" then it just adds a fresh listener each time. So, calling multiple times Trivial.notify(NotifyDescriptor nd) on the same NotifyDescriptor that has some AbstractButton options, will add as many listeners.
core-main 1b48b935fd5d thanks for the patch, i've modified it a bit though
I think you've accidentally commented Lookup.getDefault ().lookup (DialogDisplayer.class) and forced only the Trivial.
(In reply to comment #5) > I think you've accidentally commented Lookup.getDefault ().lookup > (DialogDisplayer.class) and forced only the Trivial. good catch, thanks! i've just fixed it
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/1b48b935fd5d User: S. Aubrecht <saubrecht@netbeans.org> Log: #193219 - memory leak in Trivial DialogDisplayer