FC 0.17 Crashes when padding a copied sketch created with FC 0.16

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
CharlieMAC
Posts: 228
Joined: Fri Apr 25, 2014 1:59 am

FC 0.17 Crashes when padding a copied sketch created with FC 0.16

Post by CharlieMAC »

Hi folks,

I don't know if this is a bug, but it certainly can be.
I'm trying to pad a Sketch created with the old part design within FreeCAD 0.17 and I'm doing the following steps: First, I launch FreeCAD 0.17 then open a file containing the Sketch created with 0.16, I create a new file and create a new body using the new part design, later I copy the sketch created with 0.16 and I paste it under the body I just created. I click on pad, and then select "make independant copy (recommended)". When clicking "ok" FreeCAD just crashes.

Steps to reproduce:

1.- Create a simple Sketch in 0.16 and copy it.
2.- Create a new body using the new part design workbench in 0.17
3.- Paste the copied sketch within the body.
4.- Click on pad.
5.- Click on "Make independant copy (recommended)".

GDB crash information:

Code: Select all

Thread 1 "FreeCAD" received signal SIGSEGV, Segmentation fault.
0x00007fff7da2ab46 in prepareProfileBased(Gui::Command*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::function<void (Part::Feature*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>) () from /home/charlie/FreeCAD/build/Mod/PartDesign/PartDesignGui.so
FreeCAD's information:

OS: Debian GNU/Linux 9.0 (stretch)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11509 (Git)
Build type: Release
Branch: master
Hash: fdedf8fb4d36043145e8498244177aae16c806a5
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17

UPDATE:

It crashes when selecting the option "Make a dependant copy" as well. It works well when "create cross-reference" is selected.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FC 0.17 Crashes when padding a copied sketch created with FC 0.16

Post by wmayer »

Confirmed.

The error is in the function prepareProfileBased which does this in line 862

Code: Select all

auto* pcActivePart = PartDesignGui::getPartFor(pcActiveBody, false);
Now pcActivePart is a nullptr which isn't checked but accessed a few lines below.

For this procedure it's not important that you create the sketch in v0.16. You can also create the sketch with v0.17 and then move it outside the body.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: FC 0.17 Crashes when padding a copied sketch created with FC 0.16

Post by NormandC »

Hi,
CharlieMAC wrote: Fri Jul 07, 2017 9:40 am Steps to reproduce:
Of course this should not produce a crash, but you are missing 2 important steps.
CharlieMAC wrote: Fri Jul 07, 2017 9:40 am 3.- Paste the copied sketch within the body.
Copy-paste does not put the sketch within the body. It is pasted underneath thus not included in the body, which explains why you're getting the "Make independent copy" dialog.

You need to drag & drop the Sketch over the Body so it is really inside it; then you need to attach (map) the sketch to one of the Body's datum planes. Doing so, you won't get the dialog, and you won't get a crash.
CharlieMAC
Posts: 228
Joined: Fri Apr 25, 2014 1:59 am

Re: FC 0.17 Crashes when padding a copied sketch created with FC 0.16

Post by CharlieMAC »

NormandC wrote: Fri Jul 07, 2017 5:04 pm You need to drag & drop the Sketch over the Body so it is really inside it; then you need to attach (map) the sketch to one of the Body's datum planes. Doing so, you won't get the dialog, and you won't get a crash.
Thanks for the tip! :) Should I create a bug ticket?
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: FC 0.17 Crashes when padding a copied sketch created with FC 0.16

Post by NormandC »

For what? The crash confirmed by wmayer, I'd say yes.

But as for the fact a sketch is not automatically nested under an active body when copy-pasted, I think whether it's a bug or not is debatable.
CharlieMAC
Posts: 228
Joined: Fri Apr 25, 2014 1:59 am

Re: FC 0.17 Crashes when padding a copied sketch created with FC 0.16

Post by CharlieMAC »

I have created the bug ticket concerning the crash, not the fact that the sketch is pasted outside the selected object.

https://www.freecadweb.org/tracker/view.php?id=3122

Best,

Ch.
Post Reply