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.
a globalIDSet Set if continuously filled with newly created IDs and not cleaned. Try opening and closing a.form 5 times, it will hold 5 new strings: a, a_1, a_2, a_3, a_4 Also, the id2TopComponentMap gets polluted with mappings from the above mentioned strings to empty WeakReferences.
reassigning
should be fixed now.
Closed. It's too old.
This fix is completely wrong as it allows 2 different TC IDs to be assigned to the same TC instance. Cleaning of maps and cache must be done AFTER TC instance is gc'ed to make sure different TC ID is not assigned to the same TC instance. See issue #109098 for demonstration of this incorrect behavior. Petr suggested solution using Utilities.activeReferenceQueue. I am working on it now.
Fixed in main trunk. Internal maps are cleared AFTER TC is gc'ed. Modified: /cvs/core/windows/src/org/netbeans/core/windows/Central.java new revision: 1.63; previous revision: 1.62 /cvs/core/windows/src/org/netbeans/core/windows/persistence/PersistenceManager.java new revision: 1.45; previous revision: 1.44
Note: Current fix clears only id2TopComponentMap and id2TopComponentNonPersistentMap NOT globalIDSet. It is because for TC with persistence type PERSISTENCE_ONLY_OPENED there can be already settings file with the same name ie. <TC ID>.settings so this TC ID is blocked anyway. Cleaning of unused settings files is done during start of new session. This follows rule that globalIDSet contains all already used TC IDs during one session. Unfortunately I am not able to identify persistence type of given TC only from TC ID. For persistence type PERSISTENCE_NEVER is is good to clean even globalIDSet. Another possible solution would be to delete corresponding settings file if TC is gc'ed. In this case settings file can be present only for PERSISTENCE_ONLY_OPENED as for persistent TC TC should not be gc'ed and for nonpersistent TC setiings file is not created. This scenario can happen in case: 1.User opens editor. 2.Exits IDE. Settings file for editor tc is created. 3.Start IDE again, user closes editor tc, gc is run, tc is is gc'ed ie. tc ends its existence forever. It is now safe to delete even settings file. If you think it is worth to fix this case please reopen issue.