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.

Bug 40676 - Node.destroy() is not called
Summary: Node.destroy() is not called
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Nodes (show other bugs)
Version: 3.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: t_h
URL:
Keywords: PERFORMANCE
Depends on:
Blocks: 40229 40231 40565
  Show dependency tree
 
Reported: 2004-03-02 09:50 UTC by _ pkuzel
Modified: 2008-12-22 14:36 UTC (History)
4 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ pkuzel 2004-03-02 09:50:42 UTC
public void destroy() throws IOException {
  // cleanup
  globalSingleton.removeListener(this);

  // let framework do his work
  super.destroy();
}

is not called by Children.Keys if it gets new set
of keys causing given node to disappear.
Comment 1 _ pkuzel 2004-03-02 09:52:37 UTC
It can cause serious leaks.

As workaround Node can attach to event sources using weak listeners.
Comment 2 Marian Mirilovic 2004-03-02 10:07:42 UTC
raising priority - leak is serious problem, it must be fixed for NB3.6 
Comment 3 Petr Nejedly 2004-03-02 10:44:27 UTC
Of course. destroy is used for deleting nodes, not for
no-longer-visible notification. e.g. DataNode.destroy deletes files....
Comment 4 _ pkuzel 2004-03-02 10:52:18 UTC
Javadoc suggests to place cleanup code here. Also deleting from parent
links to deleting from parent's children (defining Node lifetime).

You desribed current behaviour which is probably faulty.
Comment 5 _ pkuzel 2004-03-02 10:56:24 UTC
See also BeanNode destroy in openide.
Comment 6 Petr Nejedly 2004-03-02 11:09:24 UTC
Then I'd have to call destroy even in case the node is no longer
visible and I really don't want my IDE to delete my files just because
I've closed the explorer. Current behaviour may be faulty in your eyes
buy it has 5+ years of precedent behaviour and we can't fix all the
DataNode subclasses. Also, what would DeleteAction call?

Try listnening for nodeDestroyed event instead, although I don't agree
much that it should be fired when nodes go away (and it works only for
Children.Keys subclasses)

Comment 7 _ pkuzel 2004-03-02 12:25:32 UTC
NodeListener.nodeDesroyed is called properly (for children.keys).

Consider similar callback as requirement for upcoming Nodes redesign.
Comment 8 Antonin Nebuzelsky 2008-02-08 15:03:20 UTC
Reassigning to new module owner Tomas Holy.
Comment 9 t_h 2008-10-13 14:42:37 UTC
Use Children.Keys.destroyNodes().