Hmm, can you elaborate what you mean or what you’d like to see? Right now it loads patches from the user Rack directory. Are you saying you want it to look in additional directories?
So you shouldn’t delete a widget which is in a container. Only delete widgets which you remove
That means the destructor will crash (double delete) if the widget is also housed in the scene
The solution indeed could be to remove it but far better is do nothing. Initialize your widgets to null and always add them to something and you won’t leak
The inky condition in which you leak is if you remove a widget from a parent, don’t add it elsewhere, and don’t delete it
The bug I thought was uninitialized memory (which was indeed a bug) may not be causing the crash. My guess is that destructor is running with the widget still added so double deleted
My advice. Delete the destructor body or explicitly remove the widget and hand delete it if you need to for some reason
If a deleted widget is in a container the draw may seg fault. They must be removed before deletion. The scene uses a pointer to the widget due to perhaps multiple references. Why would it delete widgets? The module removes all its child widgets on destruct. If an instance makes a placement elsewhere it should remove before destruction. It’s a button with major functionality, malloc for a dynamic allocation is pointless for it for that and other real time reasons.
I am a bit worried about importing entire patches - Each patch should have one master audio module, correct? But most patches have an audio module, so if you import multiple patches, don’t you get a conflict?
Hmm, I had considered this – but what about in the case where you delete my module? The widget will be owned by the Scene and so wont get automatically cleaned up when the Prefabs module is deleted.
So the reason why I’m explicitly deleting the widget is so that you don’t get an increasing number of widgets on screen as you add/remove the Prefabs module.
So given that, I think I should interpret your advice to not just “request delete” but to first remove the widget from Scene.
Then, since the widget has no parent, I need to perform the deletion myself.
Remapped dll reclamation of control on GUI thread? So if the GUI halts, and modules are reclaimed, the request to clean the new with delete is perhaps a null pointer “optimized out self” as the delete context was reachable only on the GUI thread, as memory allocated by the dll is reclaimed before GUI clean up? But why did it only happen on the first test with CMake modules?
It looks like it’s crashing when I try to load your patches. Can you tell me if you do anything special, like keep your patches on a network drive, or have special permissions on the files, etc?
Any chance you’d be willing to send me a zip-file of your patches folder?
Steve, can you try the latest build with -d. If it crashes, I’m hoping it will spit out some additional logging that might help us understand what’s happening.