Widget created without create widget node (bug?)

I have a MainWidget that is created with a Create Widget node at runtime, and SubWidgets are created with Create Widget nodes as components of the MainWidget. I then remove the MainWidget and all its children with the Remove From Parent node.

This all works fine.

If I create another MainWidget and it has the same number of SubWidgets, then this also works just fine.

However, if MainWidget1 has a SubWidgetA and SubWidgetB, then when MainWidget1 is removed including SubWidgetA and SubWidgetB, then as soon as MainWidget2 is created with only 1 SubWidget, NewSubWidgetA is created fine, but inexplicably OldSubWidgetB comes back!

I put breakpoints in the code, one at the Create Widget node (the only one in the whole project for SubWidgets), and one breakpoint right after the Event Construct node inside the SubWidget event graph. The Create Widget node breakpoint fires once, but the Event Construct node breakpoint fires twice. The second time it fires, it contains the data for the old SubWidget that had been removed prior.

There appears to be no rhyme or reason for this. Is there any way that Widgets can be auto-created at runtime without a Create Widget node creating them? Mind you that there are no SubWidgets in the hierarchy for MainWidget, and are only created with that single Create Widget node.

Figured it out.

I forgot I made an array of the SubWidgets which is used to populate the new MainWidget array component of SubWidgets to add. I wasn’t clearing the outer array, and so only references were dangling and thus being added erroneously to the SubWidgets to add.

So no new extra SubWidgets were being created, but rather the Event Contruct nodes were firing from the Add Child nodes which added them to their container.

This might somehow help someone else I guess.