PicoContainer
  1. PicoContainer
  2. PICO-376

Kill Container Probably Won't Remove Child from Parent

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Labels:
      None
    • Number of attachments :
      0

      Description

      AbstractContainerBuilderContainerBuilder.killContainer() has the following code:

              PicoContainer parent = container.getParent();
              if (parent != null && parent instanceof MutablePicoContainer) {
      	    synchronized (parent) {
      	          ((MutablePicoContainer) parent).removeChildContainer(container);
      		}
              }
      
      

      Only problem is we have a situation like this:

      MutablePico parent = <blah>
      MutablePico child = parent.makeChildContainer();

      then containerBuilder.killContainer(child) will NOT remove the child from the parent (possibly resulting in a memory leak. because parent will be an ImmutablePicoContainer.

      I'll be checking in a test case that demonstrates this shortly.

        People

        • Assignee:
          Unassigned
          Reporter:
          Michael Rimov
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated: