The problem is I have no idea on how to deal with this instability. My only solution would be to convert the components to groups and then purge the components from the model so that when the plugin reloads them again it will perform the task in a predictable manner.
I’m noticing that the plugin does not crash when re-loading the nut or the washer components. These components do not get modified so I’m not sure exactly how it is handled but they do not appear to be the problem.
If I specify a different sized anchor bolt then a different file is loaded and there is no problem, the bug splat only happens when the plugin tries to reload the same file or component and enters some sort of state of confusion, or something.
After some further testing I think the editing of the main anchor bolt component is the issue. I can probably avoid the issue by creating the overall component from scratch each time and then dropping the other components into this main component so that the file or loaded components never actually get modified by the plugin. For some reason when the component is modified and then the plugin attempts to reload this component from a file it becomes unstable. I’m really not understanding what is going on here but I will do my best to come up with a work around.
The only way I’ve seen DefinitonsList#load crash SketchUp is when loading a component made in a newer SketchUp version. The other unexpected behavior I’ve seen has been related to overriding existing definitions or not having the file loaded at all as SketchUp thought an existing component was identical.
… and if you have reproducible components and code that causes a splat, please file it along with file attachments in the public API issue tracker. It can become part of the test suite to prevent regression bugs even if it might be fixed in recent version(s).
I can’t quite put my finger on it but the problem seems to be with reloading the component after it has been edited by the plugin.
My new method does not attempt to “edit” any loaded component but rather creates a new container component where I simply drop the loaded components into and then explode them into a simple group within this container component. This appears to have eliminated all of the instability.