FreeCAD 0.21.0 Revision: 36901 (Git)
Arch Linux
freecad-linkstage3-git-20230811tip.r22.g20f0f1a070-1-x86_64.pkg.tar.zst
commit/37f855dc130caa7c5ec33eb315e0b0c664ede8d9
Opening a Saved TechDraw Page of an Assembly which includes a TechDraw WeldSymbol on a Leaderline will cause FreeCAD to seg fault. This effectively makes the Document containing that Page nonrecoverable, including everything else - Parts, Pages, and Assemblies - that might also be contained in that Document.
This bug is particularly insidious in that, while the Page can be created, printed, and saved in the first instance, there is no indication that the entire saved document containing this page will be lost once closed.
This was found with TechDraw Pages based on a View from both Assembly 3 and Assembly 4, and using both a single integrated document of Parts, Pages, and Assemblies, and using completely separate Part, Assembly, and Page documents using external Linked documents.
Eventually, a TechDraw Page was created in steps, editing, saving, and reopening, as various features were added to the page. The page opened normally up until adding the WeldSymbol. Reopening the failing saved document gives variously, for example,
...
Program received signal SIGSEGV, Segmentation fault.
#0 /usr/lib/libc.so.6(+0x3e710) [0x7fb230e3e710]
#1 0x7fb0ef925549 in TechDrawGui::QGIWeldSymbol::customBoundingRect() const from /usr/lib/freecad/lib/TechDrawGui.so+0xd9
#2 0x7f3f44925466 in non-virtual thunk to TechDrawGui::QGIWeldSymbol::boundingRect() const from /usr/lib/freecad/lib/TechDrawGui.so+0x16
...
with an integrated document, and for linked documents similarly,
Program received signal SIGSEGV, Segmentation fault.
#0 /usr/lib/libc.so.6(+0x3e710) [0x7f6edf43e710]
#1 0x7f6ee2108a70 in App::Property::~Property() from /usr/lib/freecad/lib/libFreeCADApp.so+0x40
#2 0x7f6da292555a in TechDrawGui::QGIWeldSymbol::customBoundingRect() const from /usr/lib/freecad/lib/TechDrawGui.so+0xea
#3 0x7f6da2925466 in non-virtual thunk to TechDrawGui::QGIWeldSymbol::boundingRect() const from /usr/lib/freecad/lib/TechDrawGui.so+0x16
#4 0x7f6ee188048f in QGraphicsItem::prepareGeometryChange() from /usr/lib/libQt5Widgets.so.5+0x20f
...
The original document can only be partially recovered if a still-viable earlier backup exists.
Creating Linked Documents avoids the same possibility and extent of catastrophic loss. Unfortunately, it is not obvious in the documentation that this workflow is, in fact, even possible with Assembly 3. Assembly 4 documentation makes this option more apparent. Strict separation of Parts, Pages, and Assemblies can be an important defense against bugs which will crash FreeCAD.
Is there any way to analyze or "repair" a broken FreeCAD document? It is not clear how to manually "delete", say, only the TechDraw page, or just the TechDraw WeldSymbol, by directly editing the saved Document.xml file. However, it is possible to Cut and Paste Parts, Pages, and Assemblies from one Document into another new Document, to effectively split apart the independent branches of a dependency tree, to convert an integrated document into better protected separate documents. I don't know that an Assembly based upon integrated Parts can be easily converted to the same Assembly based upon external Linked Parts, though, without instead, starting over.
FreeCAD 0.21.0 Revision: 36901 (Git) Arch Linux freecad-linkstage3-git-20230811tip.r22.g20f0f1a070-1-x86_64.pkg.tar.zst commit/37f855dc130caa7c5ec33eb315e0b0c664ede8d9
Opening a Saved TechDraw Page of an Assembly which includes a TechDraw WeldSymbol on a Leaderline will cause FreeCAD to seg fault. This effectively makes the Document containing that Page nonrecoverable, including everything else - Parts, Pages, and Assemblies - that might also be contained in that Document.
This bug is particularly insidious in that, while the Page can be created, printed, and saved in the first instance, there is no indication that the entire saved document containing this page will be lost once closed.
This was found with TechDraw Pages based on a View from both Assembly 3 and Assembly 4, and using both a single integrated document of Parts, Pages, and Assemblies, and using completely separate Part, Assembly, and Page documents using external Linked documents.
Eventually, a TechDraw Page was created in steps, editing, saving, and reopening, as various features were added to the page. The page opened normally up until adding the WeldSymbol. Reopening the failing saved document gives variously, for example,
with an integrated document, and for linked documents similarly,
The original document can only be partially recovered if a still-viable earlier backup exists.
Creating Linked Documents avoids the same possibility and extent of catastrophic loss. Unfortunately, it is not obvious in the documentation that this workflow is, in fact, even possible with Assembly 3. Assembly 4 documentation makes this option more apparent. Strict separation of Parts, Pages, and Assemblies can be an important defense against bugs which will crash FreeCAD.
Is there any way to analyze or "repair" a broken FreeCAD document? It is not clear how to manually "delete", say, only the TechDraw page, or just the TechDraw WeldSymbol, by directly editing the saved Document.xml file. However, it is possible to Cut and Paste Parts, Pages, and Assemblies from one Document into another new Document, to effectively split apart the independent branches of a dependency tree, to convert an integrated document into better protected separate documents. I don't know that an Assembly based upon integrated Parts can be easily converted to the same Assembly based upon external Linked Parts, though, without instead, starting over.
The seg fault is avoided with an update from the mainstream freeCAD master branch, overwriting linkstage from https://github.com/FreeCAD/FreeCAD/raw/master/src/Mod/TechDraw/Gui/QGIWeldSymbol.cpp and https://github.com/FreeCAD/FreeCAD/raw/master/src/Mod/TechDraw/Gui/QGIWeldSymbol.h, and partially patching linkstage from https://github.com/FreeCAD/FreeCAD/raw/master/src/Mod/TechDraw/Gui/QGIView.h, with
This works, but probably better to consider [request] techdraw : can we get latest version ? #686 .