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.
When profiling New Action apisupport wizard, I found out that there is org.openide.explorer.ExplorerManager and related objects leaking via the following reference path: sun.awt.X11.XToolkitThreadBlockedHandler.tk-> sun.awt.X11.XToolkit@18e2b22-> java.awt.Toolkit$ToolkitEventMulticaster@1d9d839-> java.awt.Toolkit$ToolkitEventMulticaster@1cf633f-> java.awt.Toolkit$SelectiveAWTEventListener@68b475-> org.openide.util.AsyncInitSupport@1e356a5-> org.netbeans.modules.project.ui.TemplateChooserPanelGUI@1636bbf-> org.netbeans.modules.project.ui.TemplatesPanelGUI@11c7768-> org.netbeans.modules.project.ui.TemplatesPanelGUI$CategoriesPanel@18d21f-> org.openide.explorer.ExplorerManager@8b063 Debugging the code in AsyncInitSupport I realized that it attaches the AWTEventListener in its constructor, but its method eventDispatched() never gets through the condition SwingUtilities.isDescendingFrom(comp4Init, (Component) (event.getSource())) and thus detach() called in start() is never run. The reason is IMHO that the TemplatesChooserPanelGUI never gets inside NbDialog instance which is here as the value of event.getSource(). I am not sure where the fix should be. I want to talk to Jirka about it, but I believe this issue belongs to org.netbeans.modules.project.ui. ------- Additional comments from anebuzelsky Tue Dec 13 23:01:38 +0000 2005 Changing summary from NewFileWizard leaks ExplorerManager if run with predefined file type to NewFileWizard leaks TemplateChooserPanelGUI if run with predefined file type because TemplateChooserPanelGUI is the closest object to where the leak is held (the nondetached AWTEventListener). However, the summary of the issue is not important, the leak is what matters here. :)
Created attachment 27939 [details] Call stack of AsyncInitSupport constructor where AWTEventListener is attached
Created attachment 27940 [details] Call stack of AsyncInitSupport constructor where AWTEventListener is attached
*** Issue 70364 has been marked as a duplicate of this issue. ***
Any reason why this is not a duplicate of issue #70364? *** This issue has been marked as a duplicate of 70364 ***
Please next time say you are creating a duplicate for a reason. For the record: see issue #70364 for explanation.
The solution seems to be to move "Utilities.attachInitJob (this, this);" from the constructor into addNotify. Not sure if I will be able to write a test for this.
Hopefully fixed in the trunk. There are three scenarios: 1. on a project node invoke a context menu, New->File/Folder, finish the wizard. 2. on a project node invoke a context menu, New->some predefined template, finish the wizard. 3. on a project node invoke a context menu, New->some predefined template, but go "Back" in the wizard and then finish it. Tonda, could you please verify the fix? Thanks. Checking in TemplateChooserPanelGUI.java; /cvs/projects/projectui/src/org/netbeans/modules/project/ui/TemplateChooserPanelGUI.java,v <-- TemplateChooserPanelGUI.java new revision: 1.34; previous revision: 1.33 done
I verified the fix with the 3 scenarios you mention above (finishing the wizard with Cancel each time). It looks working fine. You can proceed with backporting to release50 branch. Thanks!
Created attachment 27972 [details] Proposed patch.
Jesse, could you please review the fix? QA, do you agree with the change? Thanks.
verified in NB 5.1, New File/folder functionality hasn't been affected and everything works as it should.
I don't know enough about this to review the patch.
Ok, Jirka or Dafe, could you please try to review the patch? Or should I ask someone else? Thanks.
The fix is reasonable and fixes the problem, I'm confirmed with this fix.
Fixed in release50 branch too: Checking in src/org/netbeans/modules/project/ui/TemplateChooserPanelGUI.java; /cvs/projects/projectui/src/org/netbeans/modules/project/ui/TemplateChooserPanelGUI.java,v <-- TemplateChooserPanelGUI.java new revision: 1.33.54.1; previous revision: 1.33 done
Verified in 5.0 (build 200512212030).