Ticket #4258 - crash on "Edit datum" in PartDesign when datum in Part

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
SIXe
Posts: 154
Joined: Sat Mar 16, 2019 3:10 pm

Ticket #4258 - crash on "Edit datum" in PartDesign when datum in Part

Post by SIXe »

Hi,

I'm just starting out with the Assembly4 workbench using the dev appimage. But it doesn't run as smooth as expected.

1) Installing any addon fails for some reason. It stalls at “Downloading info…” and “Cloning module…” It never finishes. A manual “git clone <some module>” in ~/.FreeCAD/Mod succeeds and the module works.

2) I tried to complete the 2nd tutorial on Assembly4, but FC reproducibly segfaults. I have probably not followed the tutorial 100% as this was my 1st attempt. But I feel that a program should not segfault.

The log file is attached. As well as the file that segfaults. To reproduce:

- right click on LCS_pivot → Edit datum
- select “Object's X Y Z”
- click “OK” → segfault

Is there anything else I can do to help having the issue resolved?

OS: Debian GNU/Linux 10 (buster) (X-Cinnamon/lightdm-xsession)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19323 (Git) AppImage
Build type: Release
Branch: master
Hash: 1b198453b8eb6aa2eaca4e4be4b49fee74e9de6e
Python version: 3.8.1
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
Attachments
FreeCAD.log
(14.91 KiB) Downloaded 31 times
asm_tuto2.FCStd
(48.73 KiB) Downloaded 33 times
Last edited by Kunda1 on Wed Feb 05, 2020 4:07 pm, edited 1 time in total.
Reason: Added ticket number to thread title and changed thread title to reflect issue
SIXe
Posts: 154
Joined: Sat Mar 16, 2019 3:10 pm

Re: FC segfaults - Assembly4 tutorial 2

Post by SIXe »

I started over from scratch. This time I didn't get that far. FC segfaulted when trying to create attachment LCS “LCS_disk”. When reopening the file it shows

Code: Select all

Enumeration index -1 is out of range, ignore it
in the Report view. There seems to be an issue with LCS editing. I tried to select multiple entities, probably a few wrong ones as well. Let me know if you need further information.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: FC segfaults - Assembly4 tutorial 2

Post by Zolko »

SIXe wrote: Sat Jan 25, 2020 4:02 pm The log file is attached. As well as the file that segfaults. To reproduce:

- right click on LCS_pivot → Edit datum
- select “Object's X Y Z”
- click “OK” → segfault
yes, this is a hard crash. Curiously I've never seen it. It's actually much easier to reproduce and doesn't need Assembly4

- create a Part
- create a Body inside the Part
- in the Body create an LCS (will be called Local_CS)
- attach it to the X-axis of the origin feature of the Body (is called X_Axis001 here) by Object's X Y Z
- drag the LCS from the Body to the Part
- right-click Edit Datum
- It is now referenced to X_Axis, and not X_Axis001, still to Object's X Y Z
- click OK
- crash

it's also possible to do it with 2 LCS, both dragged outside the Body, and referencing the second to the first by Object's X Y Z.

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
#0  /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7f98b6276f20]
#1  0x7f989054fe74 in PartDesignGui::TaskDlgDatumParameters::accept() from /tmp/.mount_FreeCAE4ipHQ/usr/lib/PartDesignGui.so+0xb4
...
looking in src/Mod/PartDesign/Gui/TaskDatumParameters.cpp, we can see the TaskDlgDatumParameters::accept() function, with the remark:

Code: Select all

//we need to add the copied features to the body after the command action, as otherwise FreeCAD crashes unexplainably
for(auto obj : copies) {
    if (pcActiveBody)
        pcActiveBody->addObject(obj);
    else if (pcActivePart)
        pcActivePart->addObject(obj);
}
so this is an old and known bug.
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: FC segfaults - Assembly4 tutorial 2

Post by Zolko »

Zolko wrote: Sat Jan 25, 2020 8:25 pm so this is an old and known bug.
you can even reproduce it with FreeCAD v0.17 and Datum Lines (there were no Datum LCS at the time). The error messages come exclusively from Qt things:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
#0  /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7f450eb0bf20]
#1  0x7f44d96ba3ac in PartDesignGui::TaskDlgDatumParameters::accept() from /tmp/.mount_FreeCAHis2wd/usr/lib/freecad/lib/PartDesignGui.so+0xec
#2  0x7f4511888ef3 in Gui::TaskView::TaskView::accept() from ././/lib/freecad/lib/libFreeCADGui.so+0x43
#3  0x7f450f5f087a in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x2da
#4  0x7f450f5f087a in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x2da
#5  0x7f451015c0d2 in QAbstractButton::clicked(bool) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x32
#6  /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x57b9d3) [0x7f450febf9d3]
#7  /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x57cb43) [0x7f450fec0b43]
#8  0x7f450fec0c2c in QAbstractButton::mouseReleaseEvent(QMouseEvent*) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x6c
#9  0x7f450fb5d50a in QWidget::event(QEvent*) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtGui.so.4+0xaca
#10  0x7f450fb0de2c in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x8c
#11  0x7f450fb145dd in QApplication::notify(QObject*, QEvent*) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x3ad
#12  0x7f45116e99f1 in Gui::GUIApplication::notify(QObject*, QEvent*) from ././/lib/freecad/lib/libFreeCADGui.so+0x41
#13  0x7f450f5dc4dd in QCoreApplication::notifyInternal(QObject*, QEvent*) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x6d
#14  0x7f450fb13d93 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x153
#15  /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x2449cb) [0x7f450fb889cb]
#16  0x7f450fb88269 in QApplication::x11ProcessEvent(_XEvent*) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x1559
#17  /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x26bb02) [0x7f450fbafb02]
#18  /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x2e7) [0x7f4508317417]
#19  /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x4c650) [0x7f4508317650]
#20  /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x2c) [0x7f45083176dc]
#21  0x7f450f6097a1 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x71
#22  /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x26bbb6) [0x7f450fbafbb6]
#23  0x7f450f5db0af in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x2f
#24  0x7f450f5db3a5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x175
#25  0x7f450f5e0b79 in QCoreApplication::exec() from /tmp/.mount_FreeCAHis2wd/usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x89
#26  0x7f45116a9de7 in Gui::Application::runApplication() from ././/lib/freecad/lib/libFreeCADGui.so+0x1327
#27  /tmp/.mount_FreeCAHis2wd/usr/bin/freecad(main+0x74b) [0x40355b]
#28  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f450eaeeb97]
#29  /tmp/.mount_FreeCAHis2wd/usr/bin/freecad() [0x4044c7]
OS: Ubuntu 18.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13541 (Git) AppImage
Build type: None
Branch: releases/FreeCAD-0-17
Hash: 9948ee4f1570df9216862a79705afb367b2c6ffb
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: FC segfaults - Assembly4 tutorial 2

Post by Zolko »

Zolko wrote: Sat Jan 25, 2020 8:25 pm
SIXe wrote: Sat Jan 25, 2020 4:02 pm The log file is attached. As well as the file that segfaults. To reproduce:

- right click on LCS_pivot → Edit datum
- select “Object's X Y Z”
- click “OK” → segfault
yes, this is a hard crash. Curiously I've never seen it. It's actually much easier to reproduce and doesn't need Assembly4
I understand why I didn't see it: this only happens when you edit the datum object by right-click and choosing Edit Datum. When you edit the attachment by MapMode then it doesn't happen. The dialog window seems to be the same, and the functionality is the same, but one crashes and the other doesn't. So this seems to be a purely UI problem.

The MapMode attachment editor is launched by

Code: Select all

Gui.runCommand('Part_EditAttachment')
and that one never fails. The "Edit datum" on the other hand I don't know, and I couldn't find it. It's defined in src/Mod/PartDesign/Gui/
ViewProviderDatum.cpp:

Code: Select all

void ViewProviderDatum::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
{
    QAction* act;
    act = menu->addAction(QObject::tr("Edit datum"), receiver, member);
    act->setData(QVariant((int)ViewProvider::Default));
}
It would be useful to disable this, or redirect it to Gui.runCommand('Part_EditAttachment'). I'll make a pull-request to disable this entry into the contextual menu.
try the Assembly4 workbench for FreCAD — tutorials here and here
SIXe
Posts: 154
Joined: Sat Mar 16, 2019 3:10 pm

Re: FC segfaults - Assembly4 tutorial 2

Post by SIXe »

Thanks a lot for looking into that.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: FC segfaults - Assembly4 tutorial 2

Post by Zolko »

Created a report #4258 on the tracker:

https://tracker.freecadweb.org/view.php?id=4258
try the Assembly4 workbench for FreCAD — tutorials here and here
SIXe
Posts: 154
Joined: Sat Mar 16, 2019 3:10 pm

Re: FC segfaults - Assembly4 tutorial 2

Post by SIXe »

There seems to be an issue with the validity of the bug. Since I don't know the internals, I'm not in the position to argue for one side or the other. I merely think a segfault must not happen, whatever the user does.

If there's anything else you need (logs, debug info, ...), please let me know.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ticket #4258 - crash on "Edit datum" in PartDesign when datum in Part

Post by Kunda1 »

Zolko opened issue #4258
Thread title has been updated to reflect ticket
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