Ticket #4431 - Crash after editing Part Design feature links with DAGView active

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Gregory son of Carl
Posts: 99
Joined: Mon Apr 06, 2020 7:42 pm
Location: California

Ticket #4431 - Crash after editing Part Design feature links with DAGView active

Post by Gregory son of Carl »

I've been having issues only recently where FreeCAD crashes after editing Part Design elements, but only when in context as linked objects.
I have no problems when editing the source file directly or even when editing the linked element through the Properties panel. The crash only occurs after closing the task panel for a linked part design element such as editing a sketch. This is true both when confirming and cancelling changes.

I appreciate any suggestions.


Here's my info and console output:

OS: Debian GNU/Linux 10 (buster) (KDE/default)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22284 (Git) AppImage
Build type: Release
Branch: master
Hash: bf1e8e48389f5e9e25bd77b67fe98da4213e797c
Python version: 3.8.5
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)

Code: Select all

gregory@gerg:~/FreeCAD_Projects/FreeCAD_Builds$ ./FreeCAD_0.19-22284-Linux-Conda_glibc2.12-x86_64.AppImage 
FreeCAD 0.19, Libs: 0.19R22284 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2020
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
FreeCAD wouldn't be possible without FreeCAD community.
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

Loading Assembly4 WorkBench
Sheet Metal workbench loaded
During initialization the error "'backend.qt4 is not a valid rc parameter (see rcParams.keys() for a list of valid parameters)'" occurred in /home/gregory/.FreeCAD/Mod/animation/InitGui.py
Please look into the log file for further information
During initialization the error "inconsistent use of tabs and spaces in indentation (<string>, line 48)" occurred in /home/gregory/.FreeCAD/Mod/GDT/InitGui.py
Please look into the log file for further information
Program received signal SIGSEGV, Segmentation fault.
#0  /lib/x86_64-linux-gnu/libc.so.6(+0x37840) [0x7fd13613f840]
#1  0x7fd138ba2f54 in Gui::DAG::Model::slotResetEdit(Gui::ViewProviderDocumentObject const&) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x44
#2  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so(+0x382d1c) [0x7fd13892ad1c]
#3  0x7fd138981c35 in Gui::Document::_resetEdit() from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x1f5
#4  0x7fd13891022a in Gui::Application::setEditDocument(Gui::Document*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x3a
#5  0x7fd13899177c in Gui::DocumentPy::resetEdit(_object*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x2c
#6  0x7fd1389917c4 in Gui::DocumentPy::staticCallback_resetEdit(_object*, _object*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x24
#7  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libpython3.8.so.1.0(PyCFunction_Call+0xf7) [0x7fd138393d87]
#8  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libpython3.8.so.1.0(_PyObject_MakeTpCall+0x250) [0x7fd138348850]
#9  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libpython3.8.so.1.0(_PyEval_EvalFrameDefault+0x4e36) [0x7fd1383d77d6]
#10  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libpython3.8.so.1.0(_PyEval_EvalCodeWithName+0x2e2) [0x7fd138344f92]
#11  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libpython3.8.so.1.0(PyEval_EvalCodeEx+0x44) [0x7fd138345d54]
#12  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libpython3.8.so.1.0(PyEval_EvalCode+0x1c) [0x7fd1383fb6ac]
#13  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libpython3.8.so.1.0(+0x219ecf) [0x7fd138419ecf]
#14  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libpython3.8.so.1.0(+0x252b84) [0x7fd138452b84]
#15  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libpython3.8.so.1.0(PyRun_StringFlags+0x7d) [0x7fd138452c1d]
#16  0x7fd137c4d2ba in Base::InterpreterSingleton::runString[abi:cxx11](char const*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADBase.so+0x6a
#17  0x7fd1389ec3b8 in Gui::Command::_runCommand(char const*, int, Gui::Command::DoCmd_Type, char const*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x98
#18  0x7fd1389ec5a2 in Gui::Command::_doCommand(char const*, int, Gui::Command::DoCmd_Type, char const*, ...) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x102
#19  0x7fd04a7a9e35 in PartDesignGui::TaskDlgFeatureParameters::reject() from /tmp/.mount_FreeCAbs6iBc/usr/lib/PartDesignGui.so+0x105
#20  0x7fd04a7aeaa1 in PartDesignGui::TaskDlgSketchBasedParameters::reject() from /tmp/.mount_FreeCAbs6iBc/usr/lib/PartDesignGui.so+0x31
#21  0x7fd138c85819 in Gui::TaskView::TaskView::reject() from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x59
#22  0x7fd1366867b8 in QMetaObject::activate(QObject*, int, int, void**) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Core.so.5+0x780
#23  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5(+0x274bbb) [0x7fd136f9cbbb]
#24  0x7fd1366867b8 in QMetaObject::activate(QObject*, int, int, void**) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Core.so.5+0x780
#25  0x7fd136f351fe in QAbstractButton::clicked(bool) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5+0x32
#26  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5(+0x20d8b7) [0x7fd136f358b7]
#27  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5(+0x20e14c) [0x7fd136f3614c]
#28  0x7fd136f361e8 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5+0x88
#29  0x7fd136ec7c3e in QWidget::event(QEvent*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5+0xce
#30  0x7fd136e9c82a in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5+0xde
#31  0x7fd136ea1095 in QApplication::notify(QObject*, QEvent*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5+0x79d
#32  0x7fd1389baab9 in Gui::GUIApplication::notify(QObject*, QEvent*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x89
#33  0x7fd136670186 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Core.so.5+0x88
#34  0x7fd136ea053f in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5+0x283
#35  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5(+0x1af554) [0x7fd136ed7554]
#36  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5(+0x1b03a6) [0x7fd136ed83a6]
#37  0x7fd136e9c82a in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5+0xde
#38  0x7fd136ea23f1 in QApplication::notify(QObject*, QEvent*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Widgets.so.5+0x1af9
#39  0x7fd1389baab9 in Gui::GUIApplication::notify(QObject*, QEvent*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x89
#40  0x7fd136670186 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Core.so.5+0x88
#41  0x7fd136a1640b in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Gui.so.5+0x6d3
#42  0x7fd136a16ff7 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Gui.so.5+0x175
#43  0x7fd136a03dd4 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Gui.so.5+0x64
#44  /tmp/.mount_FreeCAbs6iBc/usr/plugins/platforms/../../lib/libQt5XcbQpa.so.5(+0x5af0e) [0x7fd132402f0e]
#45  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/./libglib-2.0.so.0(g_main_context_dispatch+0x2cb) [0x7fd13364cb3b]
#46  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/./libglib-2.0.so.0(+0x54d81) [0x7fd13364cd81]
#47  /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/./libglib-2.0.so.0(g_main_context_iteration+0x2e) [0x7fd13364ce0e]
#48  0x7fd13669f42b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Core.so.5+0x63
#49  0x7fd13666cbc1 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Core.so.5+0x187
#50  0x7fd136670a39 in QCoreApplication::exec() from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libQt5Core.so.5+0x105
#51  0x7fd138932ca2 in Gui::Application::runApplication() from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x15a2
#52  /tmp/.mount_FreeCAbs6iBc/usr/bin/freecad(+0x37cd) [0x560a04df97cd]
#53  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7fd13612c09b]
#54  /tmp/.mount_FreeCAbs6iBc/usr/bin/freecad(+0x4521) [0x560a04dfa521]
Last edited by Kunda1 on Thu Sep 10, 2020 2:49 pm, edited 1 time in total.
Reason: Added ticket number to thread title + ticket name
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Crash After Editing Linked Part Design Features

Post by vocx »

Gregory son of Carl wrote: Sat Sep 05, 2020 2:49 am I've been having issues only recently where FreeCAD crashes after editing Part Design elements, but only when in context as linked objects...
I'm not following. Are you editing entire PartDesign Bodies, or the features (internal shapes)?

It's hard to see your crash if you don't provide an image of how your tree view looks like, or a test file.
#1 0x7fd138ba2f54 in Gui::DAG::Model::slotResetEdit(Gui::ViewProviderDocumentObject const&) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x44
Are you using the DAG view? If you do, try removing it.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Crash After Editing Linked Part Design Features

Post by Zolko »

vocx wrote: Sat Sep 05, 2020 8:22 pm
Gregory son of Carl wrote: Sat Sep 05, 2020 2:49 am #1 0x7fd138ba2f54 in Gui::DAG::Model::slotResetEdit(Gui::ViewProviderDocumentObject const&) from /tmp/.mount_FreeCAbs6iBc/usr/bin/../lib/libFreeCADGui.so+0x44
Are you using the DAG view? If you do, try removing it.
yes, DAG-view crashes FreeCAD a lot
try the Assembly4 workbench for FreCAD — tutorials here and here
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Crash After Editing Linked Part Design Features

Post by vocx »

Zolko wrote: Mon Sep 07, 2020 8:27 am yes, DAG-view crashes FreeCAD a lot
I remember some discussion that mentioned that the DAG view hasn't been updated in a while, so it probably cannot handle intricate dependency chains when using App Links. And I haven't heard realthunder particularly address this, so unless somebody does the work, I guess the DAG view will remain like it is right now.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
Gregory son of Carl
Posts: 99
Joined: Mon Apr 06, 2020 7:42 pm
Location: California

Re: Crash After Editing Linked Part Design Features

Post by Gregory son of Carl »

vocx wrote: Sat Sep 05, 2020 8:22 pm Are you using the DAG view? If you do, try removing it.
I was using DAG view, and it looks like removing it did the trick. Thank you!

I'm not following. Are you editing entire PartDesign Bodies, or the features (internal shapes)?

It's hard to see your crash if you don't provide an image of how your tree view looks like, or a test file.
The crash was happening on all PartDesign features that were linked. Here's an example with steps for completeness:
.
  1. Download both attached files into the same folder
  2. Activate DAG view. (Tools> Edit Parameters...> BaseApp> Preferences> DockWindows> DAGView> Enabled=True)
  3. Restart FreeCAD
  4. Open Assembly3Test.FCStd
  5. Double-click the Pad feature in Assembly3Test (shown below)
  6. Click Cancel or OK in the task window.
The crash happens immediately after releasing the mouse button
.
CrashPad.png
CrashPad.png (59.95 KiB) Viewed 2509 times
Attachments
Assembly3TestCube2.FCStd
(10.54 KiB) Downloaded 57 times
Assembly3Test.FCStd
(2.71 KiB) Downloaded 67 times
Last edited by Gregory son of Carl on Wed Sep 09, 2020 7:08 pm, edited 1 time in total.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Crash After Editing Linked Part Design Features

Post by vocx »

Gregory son of Carl wrote: Wed Sep 09, 2020 12:18 am ...
The crash was happening on all PartDesign features that were linked. Here's an example with steps for completeness:
Okay, so I think you are linking the entire Body, but it also shows the individual features as links.

And to reiterate, the DAG view was implemented in the development of v0.17, before App Link was conceived. Since then I think it has only received small changes, so I don't think it works correctly when using Links in your model.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Crash After Editing Linked Part Design Features

Post by chrisb »

I can confirm the bug. I remember realthunder saying quite some time ago that Link isn't implemented on PartDesign features yet. I may have missed the update. But whoever is responsible, Link or DAGView or both, due to the crash it is at the end of this discussion worth a bug report. For the sake of completeness you may add a step 0 to your step by step description:

0) Download both files and put them in the same directory.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Gregory son of Carl
Posts: 99
Joined: Mon Apr 06, 2020 7:42 pm
Location: California

Re: Crash After Editing Linked Part Design Features

Post by Gregory son of Carl »

Bug Report #0004431 submitted.

Instructions also updated
User avatar
chennes
Veteran
Posts: 3881
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Ticket #4431 - Crash after editing Part Design feature links with DAGView active

Post by chennes »

Maybe it will help someone familiar with the code track down the problem more quickly: I took a look at the code in DAGModel.cpp, in particular

Code: Select all

void Model::slotResetEdit(const ViewProviderDocumentObject& VPDObjectIn)
{
   RectItem *rect = (*theGraph)[findRecord(&VPDObjectIn, *graphLink).vertex].rectangle.get();
  rect->editingFinished();
  this->invalidate();
}
In this case the call to findRecord() is not actually returning a valid GraphLinkRecord, it's giving uninitialized memory due to dereferencing the end() iterator. It appears that during this call VPDObjectIn is not in graphLink (I'm not sure why the !=end() assertion in findRecord() isn't firing, actually, I thought I had those enabled...).

ETA: This is truly a shot in the dark, because I don't actually know what the code is doing, but if I blindly add a check for that condition before trying to call rect->editingFinished() the code no longer crashes. If you want to test it, here's the change I made...

Code: Select all

void Model::slotResetEdit(const ViewProviderDocumentObject& VPDObjectIn)
{
  const auto &list = graphLink->get<GraphLinkRecord::ByVPDObject>();
  auto it = list.find(&VPDObjectIn);
  if (it != list.end()) {
    RectItem* rect = (*theGraph)[findRecord(&VPDObjectIn, *graphLink).vertex].rectangle.get();
    rect->editingFinished();
  }
  this->invalidate();
}
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ticket #4431 - Crash after editing Part Design feature links with DAGView active

Post by Kunda1 »

bump
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply