After spending a few more hours trying to get to the bottom of why it keep segfaulting randomly, I can only presume that somewhere in this 6000 line mess, there is a race condition in the element tree updating code ( It accesses both GTK and X11 somehow ). As I have never used the tool, and it doesn't seem to work for me, I think this is where I leave it. I have learned quite a bit from the code base, but I think that it's too (unnecessarily) complex to update, and a full re-write might be a better use of time.
For anyone with more
masochistic tendencies skill:
To get the icons for the ToolBar to show up, i had to do a dirty hack at line 3616 to set a gtk-icon based on the label of the action. This is extra stupid because the actions are used to create the menu items as well as the toolbar. A proper solution would use Gio.Action.
The pop up field editor is what is causing the segfaults. Converting them to a normal dialog might fix it, but i think the bigger issue is the TreeView implementation. I think somewhere in the code we are leaking the values, or they get freed.
On the bright side, this has finally motivated me to finish my (very basic) programmatic CAM library and maybe turn it into a fully fledged tool.
Shameless plug:
github.com/BogdanTheGeek/libccam
- Generate gcode with C functions (Originally targeted to GRBL, but should work with LinuxCNC)
github.com/BogdanTheGeek/cginc
- OpenGL gcode visualiser with the ability to import STL files