View Issue Details

IDProjectCategoryView StatusLast Update
0004224FreeCADBugpublic2020-03-02 20:16
ReporterZolko Assigned Torealthunder  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
PlatformAppImageOSLinuxOS VersionUbuntu 18.04
Summary0004224: crash with App::Link
DescriptionHello,

when linking App::Parts from different files/documents, FreeCAD crashes when trying to edit a function of a linked part. This bug has been reported in the forum, but without answer:

https://forum.freecadweb.org/viewtopic.php?f=8&t=41552

I tried to nail the problem down to the lowest level, and it's a bug in how App::Link handles documents in the background. I've made the same assembly structure but using exclusively App::Part and App::Link functions, no Assembly4 whatsoever involved. The structure is the following:


  • Part_1 containing a Part::Cone
  • Part_2 containing a Part::Cylinder, and an App::Link to Part_1
  • asm containing an App::Link to Part_1 and another App::Link to Part_2 (which already has a link to Part_1 !)

The 3 files are attached for testing. The problem arises only when opening the top-level assembly first, when opening the parts starting from the lower level to up (Part_1 → Part_2 → Assembly) then everything works as expected, it's possible to edit Part_1 directly from Assembly document.



Part_1 (App::Part)
  │
  ├─ Origin
  └─ Cone (Part::Cone)

Part_2 (App::Part)
  │
  ├─ Origin
  ├─ Cylinder (Part::Cylinder)
  │
  └─ Part_1 (App::Link to Part_2)
       ├─ Origin
       └─ Cone (Part::Cone)
   
asm (App::Part)
  │
  ├─ Origin
  │
  ├─ Part_1 (App::Link to Part_1)
  │    ├─ Origin
  │    └─ Cone (Part::Cone)
  │  
  └─ Part_2 (App::Link to Part_2)
       ├─ Origin
       ├─ Cylinder (Part::Cylinder)
       │  
       └─ Part_1 (App::Link to Part_1)
            ├─ Origin
            └─ Cone (Part::Cone)

When opening the file asm.FCStdt, the result is actually 2 things, but which come from the same problem I think :

1) Link not restored: as you can see, the link to Part_1 is correctly restored in the file/document asm, but not in Part_2.

2) Segmentation fault: if you try to edit the Part::Cone of the — unrestored — Part_1, FreeCAD crashes:


Program received signal SIGSEGV, Segmentation fault.
#0  /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7f258117ff20]
#1  /tmp/.mount_FreeCAPpt4OD/usr/bin/../lib/libFreeCADGui.so(+0x5b3193) [0x7f2583b20193]
...
Steps To Reproduce
  • create App::Part Part_1 containing a Part::Cone
  • create App::Part Part_2 containing a Part::Cylinder
  • create App::Part Assembly
  • save all, close all
  • re-open first Part_1, then Part_2, then Assembly
  • create an App::Link of Part_1 and drag-it into Part_2 (into the App::Part, not only into the document !)
  • create an App::Link of Part_1 and drag-it into Assembly (into the App::Part, not only into the document !)
  • create App::Link of Part_2 (containing already the App::Link of Part_1) and drag-it into Assembly (into the App::Part, not only into the document !)
  • close all, re-open Assembly.FCStd

→ the link to Part_1 in Part_2 appears as "Link not restored".

When trying to edit the Part::Cone of Part_1 inside Part_2 (also called edit in place) FreeCAD segfaults.
Additional Informationhubertz @ipag-9102 ~ > FreeCAD_0.19-18846.AppImage
/tmp/.mount_FreeCAZkpZLn
FreeCAD 0.19, Libs: 0.19R18846 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2019
  ##### #### ### ####
  # # # # # #
  # ## #### #### # # # # #
  #### # # # # # # # ##### # #
  # # #### #### # # # # #
  # # # # # # # # # ## ## ##
  # # #### #### ### # # #### ## ## ##

Sheet Metal workbench loaded
Loading Assembly 4 WorkBench
connect failed: No such file or directory
5.58e-07 <App> Document.cpp(2549): Part_2#Link.LinkedObject: Link not restored
Linked object: Part
Linked file: Part_1.FCStd
Program received signal SIGSEGV, Segmentation fault.
#0 /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7fe891df2f20]
#1 /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so(+0x5b3193) [0x7fe894793193]
0000002 0x7fe894796d1b in Gui::DAG::Model::selectionChanged(Gui::SelectionChanges const&) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so+0x4b
0000003 0x7fe894790325 in Gui::DAG::View::onSelectionChanged(Gui::SelectionChanges const&) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so+0x275
0000004 0x7fe894a1536e in Gui::SelectionObserver::_onSelectionChanged(Gui::SelectionChanges const&) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so+0x4e
0000005 /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so(+0x597d2f) [0x7fe894777d2f]
0000006 0x7fe894a238bf in Gui::SelectionSingleton::slotSelectionChanged(Gui::SelectionChanges const&) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so+0x28f
0000007 /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so(+0x597d2f) [0x7fe894777d2f]
0000008 0x7fe894a244be in Gui::SelectionSingleton::notify(Gui::SelectionChanges&&) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so+0x10e
0000009 0x7fe894a2df1c in Gui::SelectionSingleton::addSelection(char const*, char const*, char const*, float, float, float, std::vector<Gui::SelectionSingleton::SelObj, std::allocator<Gui::SelectionSingleton::SelObj> > const*, bool) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so+0x8cc
0000010 0x7fe89477b1d5 in Gui::DocumentItem::updateItemSelection(Gui::DocumentObjectItem*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so+0x385
0000011 0x7fe89477b489 in Gui::DocumentItem::clearSelection(Gui::DocumentObjectItem*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so+0x199
0000012 0x7fe8947827e5 in Gui::TreeWidget::onItemSelectionChanged() from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so+0x3c5
0000013 0x7fe89253f7b8 in QMetaObject::activate(QObject*, int, int, void**) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Core.so.5+0x780
0000014 /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5(+0x3406a7) [0x7fe892f1e6a7]
0000015 0x7fe89253f7b8 in QMetaObject::activate(QObject*, int, int, void**) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Core.so.5+0x780
0000016 0x7fe8925041b6 in QItemSelectionModel::selectionChanged(QItemSelection const&, QItemSelection const&) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Core.so.5+0x2a
0000017 0x7fe892508b09 in QItemSelectionModel::emitSelectionChanged(QItemSelection const&, QItemSelection const&) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Core.so.5+0xe9
0000018 0x7fe892508fd3 in QItemSelectionModel::select(QItemSelection const&, QFlags<QItemSelectionModel::SelectionFlag>) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Core.so.5+0x1d1
0000019 0x7fe892f17fe4 in QTreeViewPrivate::select(QModelIndex const&, QModelIndex const&, QFlags<QItemSelectionModel::SelectionFlag>) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0x554
0000020 0x7fe892f1822d in QTreeView::setSelection(QRect const&, QFlags<QItemSelectionModel::SelectionFlag>) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0x1fd
0000021 0x7fe892ed491d in QAbstractItemView::mousePressEvent(QMouseEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0x2fd
0000022 0x7fe892f1a936 in QTreeView::mousePressEvent(QMouseEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0x74
0000023 0x7fe892d7dc2a in QWidget::event(QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0xba
0000024 0x7fe892de7875 in QFrame::event(QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0x27
0000025 0x7fe892ed828e in QAbstractItemView::viewportEvent(QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0x2f6
0000026 0x7fe892f1a79d in QTreeView::viewportEvent(QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0x111
0000027 0x7fe892526b6d in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Core.so.5+0xd1
0000028 0x7fe892d5281a in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0xce
0000029 0x7fe892d57095 in QApplication::notify(QObject*, QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0x79d
0000030 0x7fe8945cf9e9 in Gui::GUIApplication::notify(QObject*, QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so+0x89
0000031 0x7fe892529186 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Core.so.5+0x88
0000032 0x7fe892d5653f in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0x283
0000033 /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5(+0x1af554) [0x7fe892d8d554]
0000034 /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5(+0x1b03a6) [0x7fe892d8e3a6]
0000035 0x7fe892d5282a in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0xde
0000036 0x7fe892d583f1 in QApplication::notify(QObject*, QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Widgets.so.5+0x1af9
0000037 0x7fe8945cf9e9 in Gui::GUIApplication::notify(QObject*, QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so+0x89
0000038 0x7fe892529186 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Core.so.5+0x88
#39 0x7fe8928cf40b in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Gui.so.5+0x6d3
#40 0x7fe8928cfff7 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Gui.so.5+0x175
0000041 0x7fe8928bcdd4 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Gui.so.5+0x64
0000042 /tmp/.mount_FreeCAZkpZLn/usr/plugins/platforms/../../lib/libQt5XcbQpa.so.5(+0x5af0e) [0x7fe88c854f0e]
0000043 /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/./libglib-2.0.so.0(g_main_context_dispatch+0x2e8) [0x7fe88e7589d8]
0000044 /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/./libglib-2.0.so.0(+0x51c21) [0x7fe88e758c21]
0000045 /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/./libglib-2.0.so.0(g_main_context_iteration+0x2e) [0x7fe88e758cae]
0000046 0x7fe89255842b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Core.so.5+0x63
0000047 0x7fe892525bc1 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Core.so.5+0x187
0000048 0x7fe892529a39 in QCoreApplication::exec() from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libQt5Core.so.5+0x105
0000049 0x7fe8945506c0 in Gui::Application::runApplication() from /tmp/.mount_FreeCAZkpZLn/usr/bin/../lib/libFreeCADGui.so+0x15b0
0000050 /tmp/.mount_FreeCAZkpZLn/usr/bin/freecad(main+0x74d) [0x5636934937cd]
0000051 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7fe891dd5b97]
0000052 /tmp/.mount_FreeCAZkpZLn/usr/bin/freecad(+0x451f) [0x56369349451f]
TagsNo tags attached.
FreeCAD InformationOS: Ubuntu 18.04.3 LTS (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18846 (Git) AppImage
Build type: Release
Branch: master
Hash: ceeb776fff25c679752571d5d8e6c4c8b1fd9008
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)

Activities

Zolko

2019-12-13 15:55

reporter  

bug_linknotrestored.png (231,066 bytes)   
bug_linknotrestored.png (231,066 bytes)   
asm.FCStd1 (6,326 bytes)
Part_1.FCStd (8,924 bytes)
Part_2.FCStd (9,656 bytes)

Zolko

2019-12-13 16:12

reporter   ~0013909

Has been reported by another user, I think it's the same problem:

https://forum.freecadweb.org/viewtopic.php?f=20&t=34806&p=353631#p353612

Kunda1

2019-12-13 23:58

administrator   ~0013910

Assigning to realthunder

wmayer

2020-02-14 19:41

administrator   ~0014158

https://github.com/FreeCAD/FreeCAD/commit/0a608e94139ef94cbd58b578b7de24a911730adc
https://github.com/FreeCAD/FreeCAD/commit/5eb15e4219d3d4e5c2650f6c876dbefe17c14aa5
https://github.com/FreeCAD/FreeCAD/commit/27771fc6ee93170b6ecb978ff4da438a5b9cfe97

Related Changesets

FreeCAD: master 0a608e94

2019-12-13 21:55:52

realthunder


Committer: wmayer Details Diff
App: fix Link document restore

This fixes issue 0004224
Affected Issues
0004224
mod - src/App/Application.cpp Diff File
mod - src/App/PropertyLinks.cpp Diff File
mod - src/App/PropertyLinks.h Diff File

Issue History

Date Modified Username Field Change
2019-12-13 15:55 Zolko New Issue
2019-12-13 15:55 Zolko File Added: bug_linknotrestored.png
2019-12-13 15:55 Zolko File Added: asm.FCStd1
2019-12-13 15:55 Zolko File Added: Part_1.FCStd
2019-12-13 15:55 Zolko File Added: Part_2.FCStd
2019-12-13 16:12 Zolko Note Added: 0013909
2019-12-13 23:58 Kunda1 Assigned To => realthunder
2019-12-13 23:58 Kunda1 Status new => assigned
2019-12-13 23:58 Kunda1 Note Added: 0013910
2020-02-14 19:41 wmayer Status assigned => closed
2020-02-14 19:41 wmayer Resolution open => fixed
2020-02-14 19:41 wmayer Fixed in Version => 0.19
2020-02-14 19:41 wmayer Note Added: 0014158
2020-03-02 20:16 wmayer Changeset attached => FreeCAD master 0a608e94