FreeCAD / FreeCAD

This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler.
https://www.freecad.org
Other
19.83k stars 4.06k forks source link

[Problem] FreeCAD crashes on Loft creation when master-sketch added as a section #5855

Closed FreeCAD-Bug-Importer closed 1 month ago

FreeCAD-Bug-Importer commented 2 years ago

Issue imported from https://tracker.freecad.org/view.php?id=3751

Original report text

May be related to #5642 Reproduces if the master-sketch added as a not last section of Loft.

Additional information

$ freecad-daily FreeCAD 0.18, Libs: 0.18R15495 (Git) (freecad-daily:5562): 
IBUS-WARNING **: 13:29:16.710: Unable to connect to ibus: Could not connect: Connection refused 'ascii' codec can't decode byte 0xd0 in position 33: ordinal not in range(128) ** 
WARNING **: 13:29:21.446: invalid source position for vertical gradient ** 
WARNING **: 13:29:21.446: invalid source position for vertical gradient 
Program received signal SIGSEGV, Segmentation fault. 
#0 /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7f2e23e5af20] 
#1 /usr/lib/x86_64-linux-gnu/libTKTopAlgo.so.7(+0x17bcb5) [0x7f2de1d9bcb5]
#2 0x7f2de1d9c77e in BRepLib::EncodeRegularity(TopoDS_Shape const&, double) from /usr/lib/x86_64-linux-gnu/libTKTopAlgo.so.7+0x14e 
#3 0x7f2de0a7ada8 in BRepOffsetAPI_ThruSections::Build() from /usr/lib/x86_64-linux-gnu/libTKOffset.so.7+0xd28 
#4 0x7f2d91d9514b in PartDesign::Loft::execute() from /usr/lib/freecad-daily/lib/_PartDesign.so+0x7db 
#5 0x7f2e2641e035 in App::DocumentObject::recompute() from /usr/lib/freecad-daily/lib/libFreeCADApp.so+0x155 
#6 0x7f2de55af55b in Part::Feature::recompute() from /usr/lib/freecad-daily/lib/Part.so+0xb 
#7 0x7f2e263d2324 in App::Document::_recomputeFeature(App::DocumentObject*) from /usr/lib/freecad-daily/lib/libFreeCADApp.so+0xb4 
#8 0x7f2e263d9df3 in App::Document::recomputeFeature(App::DocumentObject*) from /usr/lib/freecad-daily/lib/libFreeCADApp.so+0x83 
#9 0x7f2d915fe490 in PartDesignGui::TaskLoftParameters::onSelectionChanged(Gui::SelectionChanges const&) from /usr/lib/freecad-daily/lib/PartDesignGui.so+0xf0 
#10 0x7f2e26edc896 in Gui::SelectionObserver::_onSelectionChanged(Gui::SelectionChanges const&) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x56 
#11 0x7f2e26eeac3f in boost::signals2::detail::signal_impl<void (Gui::SelectionChanges const&), boost::signals2::optional_last_value<void>, int, std::less<int>, boost::function<void (Gui::SelectionChanges const&)>, boost::function<void (boost::signals2::connection const&, Gui::SelectionChanges const&)>, boost::signals2::mutex>::operator()(Gui::SelectionChanges const&) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x20f
#12 0x7f2e26ee4f21 in Gui::SelectionSingleton::addSelection(char const*, char const*, char const*, float, float, float) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x281
#13 0x7f2e26d49aca in Gui::SoFCUnifiedSelection::handleEvent(SoHandleEventAction*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0xcba #14 0x7f2e237b6ea0 in SoNode::handleEventS(SoAction*, SoNode*) from /usr/lib/x86_64-linux-gnu/libCoin.so.80+0x80 #15 0x7f2e2355ba54 in SoAction::traverse(SoNode*) from /usr/lib/x86_64-linux-gnu/libCoin.so.80+0x64
#16 0x7f2e236c1425 in SoChildList::traverse(SoAction*, int, int) from /usr/lib/x86_64-linux-gnu/libCoin.so.80+0x165
#17 0x7f2e237ab436 in SoGroup::doAction(SoAction*) from /usr/lib/x86_64-linux-gnu/libCoin.so.80+0x56
#18 0x7f2e237ca7c7 in SoSeparator::doAction(SoAction*) from /usr/lib/x86_64-linux-gnu/libCoin.so.80+0x27
#19 0x7f2e237b6ea0 in SoNode::handleEventS(SoAction*, SoNode*) from /usr/lib/x86_64-linux-gnu/libCoin.so.80+0x80 #20 0x7f2e2355ba54 in SoAction::traverse(SoNode*) from /usr/lib/x86_64-linux-gnu/libCoin.so.80+0x64
#21 0x7f2e23566a4a in SoHandleEventAction::beginTraversal(SoNode*) from /usr/lib/x86_64-linux-gnu/libCoin.so.80+0x7a #22 0x7f2e2355d262 in SoAction::apply(SoNode*) from /usr/lib/x86_64-linux-gnu/libCoin.so.80+0x442
#23 0x7f2e236e0c19 in SoEventManager::actuallyProcessEvent(SoEvent const*) from /usr/lib/x86_64-linux-gnu/libCoin.so.80+0x69
#24 0x7f2e26dc2dce in SIM::Coin3D::Quarter::QuarterWidget::processSoEvent(SoEvent const*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x1e 
#25 0x7f2e26dcae26 in SIM::Coin3D::Quarter::SoQTQuarterAdaptor::processSoEvent(SoEvent const*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x56 
#26 0x7f2e26df41a9 in Gui::View3DInventorViewer::processSoEventBase(SoEvent const*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x9 
#27 0x7f2e26dd93c9 in Gui::BlenderNavigationStyle::processSoEvent(SoEvent const*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x219
#28 0x7f2e26dd4848 in Gui::NavigationStyle::processEvent(SoEvent const*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0xf8
#29 0x7f2e26df4123 in Gui::View3DInventorViewer::processSoEvent(SoEvent const*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x63
#30 0x7f2e26dbd21c in SIM::Coin3D::Quarter::EventFilter::eventFilter(QObject*, QEvent*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x1ac
#31 0x7f2e24938a16 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x86
#32 0x7f2e24e6501c in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x6c
#33 0x7f2e24e6c136 in QApplication::notify(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x476
#34 0x7f2e26b967c8 in Gui::GUIApplication::notify(QObject*, QEvent*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x88
#35 0x7f2e249388ad in QCoreApplication::notifyInternal(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x8d
#36 0x7f2e24e6b73d in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x14d
#37 /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x249452) [0x7f2e24ee9452]
#38 0x7f2e24ee8ce3 in QApplication::x11ProcessEvent(_XEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x16b3
#39 /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x272592) [0x7f2e24f12592]
#40 /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x2e7) [0x7f2e1d63f387]
#41 /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x4c5c0) [0x7f2e1d63f5c0]
#42 /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x2c) [0x7f2e1d63f64c]
#43 0x7f2e2496920e in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x7e
#44 /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x272666) [0x7f2e24f12666]
#45 0x7f2e2493712f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x3f
#46 0x7f2e24937495 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x1b5
#47 0x7f2e2493d459 in QCoreApplication::exec() from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x99
#48 0x7f2e26b22c7a in Gui::Application::runApplication() from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x16ba
#49 freecad-daily(main+0x6db) [0x55f64076043b]
#50 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f2e23e3db97] #51 freecad-daily(_start+0x2a) [0x55f6407615ea]][/quote]

Steps to reproduce

  1. Create two sketches on different planes
  2. Activate a Loft tool
  3. Select sketch A as base
  4. Add sketch A as a section
  5. Add sketch B as a section
  6. FreeCAD crashes after clicking on the sketch B

https://youtu.be/fKxVAzo2-0A

Other bug information

Discussion from Mantis ticket

Comment by sleeply4cat 2018-12-28 11:12

omg, sorry. Attached a log by the right way.

Also, build info: OS: Ubuntu 18.04.1 LTS Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.18.15495 (Git) Build type: Release Branch: master Hash: 9c7128ea77fc1046e11ebf2fbeb41216446eac4f Python version: 2.7.15rc1 Qt version: 4.8.7 Coin version: 4.0.0a OCC version: 7.3.0 Locale: English/UnitedStates (en_US)

xtemp09 commented 1 year ago

Easily reproducible on

The latest stable on Windows ```ruby OS: Windows 10 Version 2009 Word size of FreeCAD: 64-bit Version: 0.20.2.29177 +426 (Git) Build type: Release Branch: (HEAD detached from 0.20.2) Hash: 930dd9a76203a3260b1e6256c70c1c3cad8c5cb8 Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3 Locale: Russian/Russia (ru_RU) ```
The git version on Ubuntu 22.04 ```ruby OS: Ubuntu 22.04.2 LTS (ubuntu:GNOME/ubuntu) Word size of FreeCAD: 64-bit Version: 0.21.0.33027 (Git) Build type: Debug Branch: master Hash: 25157275f07075ccd40873837f9b0f48aef28c5a Python 3.10.6, Qt 5.15.3, Coin 4.0.0, Vtk 7.1.1, OCC 7.5.1 Locale: English/United States (en_US) ```

The problem is caused by BRepLib::EncodeRegularity(TopoDS_Shape const&, double) and BRepOffsetAPI_ThruSections::Build().

Stack trace ```c++ * thread #1, name = 'FreeCAD', stop reason = signal SIGSEGV: invalid address (fault address: 0x0) * frame #0: 0x00007fffb6136fe4 libTKTopAlgo.so.7`___lldb_unnamed_symbol6984 + 116 frame #1: 0x00007fffb6137921 libTKTopAlgo.so.7`BRepLib::EncodeRegularity(TopoDS_Shape const&, double) + 81 frame #2: 0x00007fffb6f27933 libTKOffset.so.7`BRepOffsetAPI_ThruSections::Build() + 2243 frame #3: 0x00007fffbd4a61d8 _PartDesign.so`PartDesign::Loft::execute(this=0x000061f0004d8c00) at FeatureLoft.cpp:230:18 [opt] frame #4: 0x00007ffff60ac33b libFreeCADApp.so`App::DocumentObject::recompute(this=0x000061f0004d8c00) at DocumentObject.cpp:161:22 [opt] frame #5: 0x00007fffb47ef7fc Part.so`Part::Feature::recompute(this=) at PartFeature.cpp:94:33 [opt] frame #6: 0x00007ffff6039a38 libFreeCADApp.so`App::Document::_recomputeFeature(this=0x000061e000039000, Feat=0x000061f0004d8c00) at Document.cpp:3027:32 [opt] frame #7: 0x00007ffff603b6e2 libFreeCADApp.so`App::Document::recomputeFeature(this=0x000061e000039000, Feat=0x000061f0004d8c00, recursive=false) at Document.cpp:3086:13 [opt] frame #8: 0x00007fff753cf034 PartDesignGui.so`PartDesignGui::TaskLoftParameters::onSelectionChanged(this=0x0000614000026400, msg=) at TaskLoftParameters.cpp:165:13 [opt] frame #9: 0x00007ffff701093a libFreeCADGui.so`Gui::SelectionObserver::_onSelectionChanged(this=, msg=) at Selection.cpp:148:9 [opt] frame #10: 0x00007ffff6d81d87 libFreeCADGui.so`boost::signals2::detail::slot_call_iterator_t, std::_List_iterator>, boost::signals2::slot>, boost::signals2::mutex>>>, boost::signals2::detail::connection_body>, boost::signals2::slot>, boost::signals2::mutex>>::dereference(this=0x00007fffffffb1b0) const at slot_call_iterator.hpp:110:35 [opt] frame #11: 0x00007ffff6d80fde libFreeCADGui.so`boost::signals2::detail::signal_impl, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()(Gui::SelectionChanges const&) [inlined] boost::signals2::detail::slot_call_iterator_t, std::_List_iterator>, boost::signals2::slot>, boost::signals2::mutex>>>, boost::signals2::detail::connection_body>, boost::signals2::slot>, boost::signals2::mutex>>::reference boost::iterators::iterator_core_access::dereference, std::_List_iterator>, boost::signals2::slot>, boost::signals2::mutex>>>, boost::signals2::detail::connection_body>, boost::signals2::slot>, boost::signals2::mutex>>>(f=0x00007fffffffb1b0) at iterator_facade.hpp:550:20 [opt] frame #12: 0x00007ffff6d80fd6 libFreeCADGui.so`boost::signals2::detail::signal_impl, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()(Gui::SelectionChanges const&) [inlined] boost::iterators::detail::iterator_facade_base, std::_List_iterator>, boost::signals2::slot>, boost::signals2::mutex>>>, boost::signals2::detail::connection_body>, boost::signals2::slot>, boost::signals2::mutex>>, boost::signals2::detail::void_type, boost::iterators::single_pass_traversal_tag, boost::signals2::detail::void_type const&, long, false, false>::operator*(this=0x00007fffffffb1b0) const at iterator_facade.hpp:656:20 [opt] frame #13: 0x00007ffff6d80fd6 libFreeCADGui.so`boost::signals2::detail::signal_impl, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()(Gui::SelectionChanges const&) at optional_last_value.hpp:57:13 [opt] frame #14: 0x00007ffff6d80fb5 libFreeCADGui.so`boost::signals2::detail::signal_impl, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()(Gui::SelectionChanges const&) [inlined] void boost::signals2::detail::combiner_invoker::operator(), boost::signals2::detail::slot_call_iterator_t, std::_List_iterator>, boost::signals2::slot>, boost::signals2::mutex>>>, boost::signals2::detail::connection_body>, boost::signals2::slot>, boost::signals2::mutex>>>(this=, combiner=, first=, last=slot_call_iterator_t, std::_List_iterator >, boost::signals2::slot >, boost::signals2::mutex> > >, boost::signals2::detail::connection_body >, boost::signals2::slot >, boost::signals2::mutex> > @ 0x0000560c8b05c1b0) const at result_type_wrapper.hpp:64:11 [opt] frame #15: 0x00007ffff6d80fb5 libFreeCADGui.so`boost::signals2::detail::signal_impl, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()(this=, args=0x00007fffffffb248) at signal_template.hpp:242:18 [opt] frame #16: 0x00007ffff70138a7 libFreeCADGui.so`Gui::SelectionSingleton::slotSelectionChanged(Gui::SelectionChanges const&) [inlined] boost::signals2::signal, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()(this=0x000061700000b9d0, args=0x00007fffffffb248) at signal_template.hpp:722:16 [opt] frame #17: 0x00007ffff701388e libFreeCADGui.so`Gui::SelectionSingleton::slotSelectionChanged(this=0x000061700000b980, msg=) at Selection.cpp:577:13 [opt] frame #18: 0x00007ffff6d81d87 libFreeCADGui.so`boost::signals2::detail::slot_call_iterator_t, std::_List_iterator>, boost::signals2::slot>, boost::signals2::mutex>>>, boost::signals2::detail::connection_body>, boost::signals2::slot>, boost::signals2::mutex>>::dereference(this=0x00007fffffffb570) const at slot_call_iterator.hpp:110:35 [opt] frame #19: 0x00007ffff6d80fde libFreeCADGui.so`boost::signals2::detail::signal_impl, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()(Gui::SelectionChanges const&) [inlined] boost::signals2::detail::slot_call_iterator_t, std::_List_iterator>, boost::signals2::slot>, boost::signals2::mutex>>>, boost::signals2::detail::connection_body>, boost::signals2::slot>, boost::signals2::mutex>>::reference boost::iterators::iterator_core_access::dereference, std::_List_iterator>, boost::signals2::slot>, boost::signals2::mutex>>>, boost::signals2::detail::connection_body>, boost::signals2::slot>, boost::signals2::mutex>>>(f=0x00007fffffffb570) at iterator_facade.hpp:550:20 [opt] frame #20: 0x00007ffff6d80fd6 libFreeCADGui.so`boost::signals2::detail::signal_impl, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()(Gui::SelectionChanges const&) [inlined] boost::iterators::detail::iterator_facade_base, std::_List_iterator>, boost::signals2::slot>, boost::signals2::mutex>>>, boost::signals2::detail::connection_body>, boost::signals2::slot>, boost::signals2::mutex>>, boost::signals2::detail::void_type, boost::iterators::single_pass_traversal_tag, boost::signals2::detail::void_type const&, long, false, false>::operator*(this=0x00007fffffffb570) const at iterator_facade.hpp:656:20 [opt] frame #21: 0x00007ffff6d80fd6 libFreeCADGui.so`boost::signals2::detail::signal_impl, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()(Gui::SelectionChanges const&) at optional_last_value.hpp:57:13 [opt] frame #22: 0x00007ffff6d80fb5 libFreeCADGui.so`boost::signals2::detail::signal_impl, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()(Gui::SelectionChanges const&) [inlined] void boost::signals2::detail::combiner_invoker::operator(), boost::signals2::detail::slot_call_iterator_t, std::_List_iterator>, boost::signals2::slot>, boost::signals2::mutex>>>, boost::signals2::detail::connection_body>, boost::signals2::slot>, boost::signals2::mutex>>>(this=, combiner=, first=, last=slot_call_iterator_t, std::_List_iterator >, boost::signals2::slot >, boost::signals2::mutex> > >, boost::signals2::detail::connection_body >, boost::signals2::slot >, boost::signals2::mutex> > @ 0x0000560c8b3a98e0) const at result_type_wrapper.hpp:64:11 [opt] frame #23: 0x00007ffff6d80fb5 libFreeCADGui.so`boost::signals2::detail::signal_impl, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()(this=, args=0x000061400002a600) at signal_template.hpp:242:18 [opt] frame #24: 0x00007ffff701290c libFreeCADGui.so`Gui::SelectionSingleton::notify(Gui::SelectionChanges&&) [inlined] boost::signals2::signal, int, std::less, boost::function, boost::function, boost::signals2::mutex>::operator()(this=0x000061700000b9b8, args=0x000061400002a600) at signal_template.hpp:722:16 [opt] frame #25: 0x00007ffff70128fb libFreeCADGui.so`Gui::SelectionSingleton::notify(this=0x000061700000b980, Chng=0x00007fffffffb638) at Selection.cpp:420:17 [opt] frame #26: 0x00007ffff7016f7e libFreeCADGui.so`Gui::SelectionSingleton::addSelection(this=0x000061700000b980, pDocName=, pObjectName=, pSubName=, x=0, y=0, z=0, pickedList=, clearPreselect=) at Selection.cpp:931:5 [opt] frame #27: 0x00007ffff6df5428 libFreeCADGui.so`Gui::SoFCUnifiedSelection::setSelection(this=0x00006160000c5400, infos=size=1, ctrlDown=false) at SoFCUnifiedSelection.cpp:664:32 [opt] frame #28: 0x00007ffff6df5d44 libFreeCADGui.so`Gui::SoFCUnifiedSelection::handleEvent(this=0x00006160000c5400, action=0x000060e0000cdbc0) at SoFCUnifiedSelection.cpp:746:16 [opt] frame #29: 0x00007ffff4876095 libCoin.so.80c`SoAction::traverse(SoNode*) + 101 frame #30: 0x00007ffff4a10908 libCoin.so.80c`SoChildList::traverse(SoAction*, int, int) + 360 frame #31: 0x00007ffff4a57660 libCoin.so.80c`SoGroup::doAction(SoAction*) + 80 frame #32: 0x00007ffff4a6c66c libCoin.so.80c`SoSeparator::doAction(SoAction*) + 44 frame #33: 0x00007ffff4876095 libCoin.so.80c`SoAction::traverse(SoNode*) + 101 frame #34: 0x00007ffff487fa9b libCoin.so.80c`SoHandleEventAction::beginTraversal(SoNode*) + 171 frame #35: 0x00007ffff48766e8 libCoin.so.80c`SoAction::apply(SoNode*) + 200 frame #36: 0x00007ffff4a25559 libCoin.so.80c`SoEventManager::actuallyProcessEvent(SoEvent const*) + 121 frame #37: 0x00007ffff6e928cc libFreeCADGui.so`SIM::Coin3D::Quarter::QuarterWidget::processSoEvent(this=, event=) at QuarterWidget.cpp:1028:36 [opt] frame #38: 0x00007ffff6e98e32 libFreeCADGui.so`SIM::Coin3D::Quarter::SoQTQuarterAdaptor::processSoEvent(this=0x000061b000056300, event=0x000060300012d800) at SoQTQuarterAdaptor.cpp:717:49 [opt] frame #39: 0x00007ffff6ec8e89 libFreeCADGui.so`Gui::View3DInventorViewer::processSoEventBase(this=, ev=) at View3DInventorViewer.cpp:2307:23 [opt] frame #40: 0x00007ffff6ea35e5 libFreeCADGui.so`Gui::NavigationStyle::processSoEvent(this=0x00006110000db9c0, ev=0x000060300012d800) at NavigationStyle.cpp:1520:29 [opt] frame #41: 0x00007ffff6ea659b libFreeCADGui.so`Gui::CADNavigationStyle::processSoEvent(this=0x00006110000db9c0, ev=0x000060300012d800) at CADNavigationStyle.cpp:319:32 [opt] frame #42: 0x00007ffff6ea33f0 libFreeCADGui.so`Gui::NavigationStyle::processEvent(this=0x00006110000db9c0, ev=0x000060300012d800) at NavigationStyle.cpp:1491:23 [opt] frame #43: 0x00007ffff6ec8e61 libFreeCADGui.so`Gui::View3DInventorViewer::processSoEvent(this=0x000061b000056300, ev=0x000060300012d800) at View3DInventorViewer.cpp:0:31 [opt] frame #44: 0x00007ffff6e8adfb libFreeCADGui.so`SIM::Coin3D::Quarter::EventFilter::eventFilter(this=0x00006020001446e0, obj=, qevent=0x00007fffffffc5a0) at EventFilter.cpp:167:50 [opt] frame #45: 0x00007ffff32b9b9a libQt5Core.so.5`QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) + 170 frame #46: 0x00007ffff3f6c702 libQt5Widgets.so.5`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 114 frame #47: 0x00007ffff3f74364 libQt5Widgets.so.5`QApplication::notify(QObject*, QEvent*) + 2692 frame #48: 0x00007ffff6b9c8fb libFreeCADGui.so`Gui::GUIApplication::notify(this=0x00007fffffffd2e0, receiver=0x0000604000164180, event=0x00007fffffffca70) at GuiApplication.cpp:85:34 [opt] frame #49: 0x00007ffff32b9e3a libQt5Core.so.5`QCoreApplication::notifyInternal2(QObject*, QEvent*) + 314 frame #50: 0x00007ffff3f72e47 libQt5Widgets.so.5`QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer&, bool, bool) + 439 frame #51: 0x00007ffff3fc8d40 libQt5Widgets.so.5`___lldb_unnamed_symbol14622 + 736 frame #52: 0x00007ffff3fcbfd5 libQt5Widgets.so.5`___lldb_unnamed_symbol14633 + 517 frame #53: 0x00007ffff3f6c713 libQt5Widgets.so.5`QApplicationPrivate::notify_helper(QObject*, QEvent*) + 131 frame #54: 0x00007ffff6b9c8fb libFreeCADGui.so`Gui::GUIApplication::notify(this=0x00007fffffffd2e0, receiver=0x0000606000068b20, event=0x00007fffffffcf30) at GuiApplication.cpp:85:34 [opt] frame #55: 0x00007ffff32b9e3a libQt5Core.so.5`QCoreApplication::notifyInternal2(QObject*, QEvent*) + 314 frame #56: 0x00007ffff3741307 libQt5Gui.so.5`QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) + 1687 frame #57: 0x00007ffff3716a2c libQt5Gui.so.5`QWindowSystemInterface::sendWindowSystemEvents(QFlags) + 172 frame #58: 0x00007fffebdf8d6e libQt5XcbQpa.so.5`___lldb_unnamed_symbol4098 + 30 frame #59: 0x00007ffff231bd3b libglib-2.0.so.0`g_main_context_dispatch + 619 frame #60: 0x00007ffff23706c8 libglib-2.0.so.0`___lldb_unnamed_symbol2709 + 488 frame #61: 0x00007ffff23193e3 libglib-2.0.so.0`g_main_context_iteration + 51 frame #62: 0x00007ffff33130b8 libQt5Core.so.5`QEventDispatcherGlib::processEvents(QFlags) + 104 frame #63: 0x00007ffff32b875b libQt5Core.so.5`QEventLoop::exec(QFlags) + 299 frame #64: 0x00007ffff32c0cf4 libQt5Core.so.5`QCoreApplication::exec() + 148 frame #65: 0x00007ffff6ae54d4 libFreeCADGui.so`Gui::Application::runApplication() at Application.cpp:2368:9 [opt] frame #66: 0x000055555558d300 FreeCAD`main(argc=, argv=) at MainGui.cpp:270:13 [opt] frame #67: 0x00007ffff2429d90 libc.so.6`__libc_start_call_main(main=(FreeCAD`main at MainGui.cpp:99), argc=1, argv=0x00007fffffffdfb8) at libc_start_call_main.h:58:16 frame #68: 0x00007ffff2429e40 libc.so.6`__libc_start_main_impl(main=(FreeCAD`main at MainGui.cpp:99), argc=1, argv=0x00007fffffffdfb8, init=, fini=, rtld_fini=, stack_end=0x00007fffffffdfa8) at libc-start.c:392:3 frame #69: 0x000055555555f905 FreeCAD`_start + 37 ```
maxwxyz commented 8 months ago

It's creating an error but not crashing at my side

About Info

``` OS: Windows 11 build 22631 Word size of FreeCAD: 64-bit Version: 0.22.0dev.36082 (Git) Build type: Release Branch: main Hash: 7a025e4e60a607bdbdd1599627ce13bb8eeda071 Python 3.10.13, Qt 5.15.8, Coin 4.0.2, Vtk 9.2.6, OCC 7.6.3 Locale: German/Germany (de_DE) Installed mods: * 3DfindIT 1.2.0 * BIM 2021.12.0 * CfdOF 1.25.2 * CurvedShapes 1.0.5 * Curves 0.6.23 * Defeaturing 1.2.2 * fasteners 0.5.12 * FEMbyGEN 2.1.0 * freecad.gears 1.0.0 * freecad_metal_workbench 0.0.1 * OpenDark 2023.12.17 * sheetmetal 0.4.2 ```

AIRCAP commented 1 month ago

Crash still happens in latest code:

OS: Ubuntu 20.04.6 LTS (XFCE/xfce)
Word size of FreeCAD: 64-bit
Version: 1.1.0dev.38842 (Git)
Build type: Debug
Branch: main
Hash: 69676a0f9d2d5b288bda3d1c6dbad5a6ec26bfaa
Python 3.8.10, Qt 5.12.8, Coin 4.0.0, Vtk 7.1.1, OCC 7.6.3
Locale: English/United States (en_US)
Stylesheet/Theme/QtStyle: unset/FreeCAD Classic/Qt default
206.449 Tree.cpp(295): [ComboView] duplicate child item Unnamed#AdditiveLoft.Sketch
Program received signal SIGSEGV, Segmentation fault.
#0  /lib/x86_64-linux-gnu/libc.so.6(+0x43090) [0x7f6d0c423090]
#1  /usr/lib/x86_64-linux-gnu/libTKTopAlgo.so.7(+0x1d61ca) [0x7f6ce54fa1ca]
#2  0x7f6ce54fadbf in BRepLib::EncodeRegularity(TopoDS_Shape const&, double) from /usr/lib/x86_64-linux-gnu/libTKTopAlgo.so.7+0x15f
#3  0x7f6ce4452d00 in BRepOffsetAPI_ThruSections::Build(Message_ProgressRange const&) from /usr/lib/x86_64-linux-gnu/libTKOffset.so.7+0x13a0
#4  0x7f6ce60ff342 in Part::TopoShape::makeElementLoft(std::vector<Part::TopoShape, std::allocator<Part::TopoShape> > const&, Part::IsSolid, Part::IsRuled, Part::IsClosed, int, char const*) from ~/src/FreeCAD/main/Mod/Part/Part.so+0x500
#5  0x7f6cdbf44198 in PartDesign::Loft::execute() from ~/src/FreeCAD/main/Mod/PartDesign/_PartDesign.so+0x71a
#6  0x7f6d0f2c3628 in App::DocumentObject::recompute() from ~/src/FreeCAD/main/lib/libFreeCADApp.so+0x88
#7  0x7f6ce5db0695 in Part::Feature::recompute() from ~/src/FreeCAD/main/Mod/Part/Part.so+0x1f
#8  0x7f6cdbe4ecb6 in PartDesign::Feature::recompute() from ~/src/FreeCAD/main/Mod/PartDesign/_PartDesign.so+0xe2
#9  0x7f6d0f1d3b90 in App::Document::_recomputeFeature(App::DocumentObject*) from ~/src/FreeCAD/main/lib/libFreeCADApp.so+0x1fe
#10  0x7f6d0f1d49cc in App::Document::recomputeFeature(App::DocumentObject*, bool) from ~/src/FreeCAD/main/lib/libFreeCADApp.so+0x112
#11  0x7f6c6223e1f5 in PartDesignGui::TaskFeatureParameters::recomputeFeature() from ~/src/FreeCAD/main/Mod/PartDesign/PartDesignGui.so+0x7b
#12  0x7f6c62303712 in PartDesignGui::TaskLoftParameters::onSelectionChanged(Gui::SelectionChanges const&) from ~/src/FreeCAD/main/Mod/PartDesign/PartDesignGui.so+0x42a
AIRCAP commented 1 month ago

here's a file to reproduce.

steps:

  1. load file in FreeCad
  2. trigger recompute (ctrl+r)

expected outcome: no crash

actual outcome segfault

loftcrash.zip

AIRCAP commented 1 month ago

can also be reproduced in CLI

recompute.py:

import FreeCAD
FreeCAD.ActiveDocument.recompute()

freecadCmd loftcrash.FCStd recompute.py ---> segfault

AIRCAP commented 1 month ago

as a workaround i would propose to check whether the first section is "identical" to the base - however I haven't found any method or other functionality to test for identity between shapes.

AIRCAP commented 1 month ago

this PR goes too short.

the segfault can be triggered if any two consecutive shapes in the loft are identical - an easy way to make identical distinct shapes to trigger that is use shapebinders of sketches and add those to the loft. - the binders can be moved independently, if they are in a different spot, they don#t trigger the crash, if they are in the same spot, they do

AIRCAP commented 1 month ago

ok new version of PR should fix this.