[BUG-FIXED] Crash on Datum plane

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!
User avatar
PrzemoF
Posts: 2516
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

[BUG-FIXED] Crash on Datum plane

Postby PrzemoF » Fri Jun 14, 2019 8:08 pm

Can someone test it?
phpBB [video]

It ends up with hard crash.

Edit: Video replaced with open source format/better quality recording
chrisb
Posts: 15779
Joined: Tue Mar 17, 2015 9:14 am

Re: [BUG?] Crash on Datum plane

Postby chrisb » Fri Jun 14, 2019 8:49 pm

I see the same behaviour here. FreeCAD crashes after confirming the question how to attach. Which version do you use?

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16933 (Git)
Build type: Release
Branch: master
Hash: 4494d384a6b7e183dd4ae12baadfcf6972039c45
Python version: 3.7.3
Qt version: 5.9.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Germany (en_DE)
User avatar
PrzemoF
Posts: 2516
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: [BUG?] Crash on Datum plane

Postby PrzemoF » Fri Jun 14, 2019 9:13 pm

Thanks for the test! My version is unknown :D It's the official one from fedora 30 unless I messed up something

OS: "Fedora release 30 (Thirty)"
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.Unknown
Build type: Unknown
Python version: 3.7.3
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 6.9.1.oce-0.18
Locale: Polish/Poland (pl_PL)
UR_
Posts: 835
Joined: Tue Jan 03, 2017 8:42 pm

Re: [BUG?] Crash on Datum plane

Postby UR_ » Sat Jun 15, 2019 3:30 am

Got this report view (win 10):

PartDesign::Plane / DatumPlane: Links go out of the allowed scope
QWindowsWindow::setGeometry: Unable to set geometry 487x243+1678+956 on QWidgetWindow/'PartDesignGui__DlgReferenceWindow'. Resulting geometry: 487x256+1678+956 (frame: 11, 45, 11, 11, custom margin: 0, 0, 0, 0, minimum size: 377x218, maximum size: 16777215x16777215).
QWindowsWindow::setGeometry: Unable to set geometry 487x243+1678+956 on QWidgetWindow/'PartDesignGui__DlgReferenceWindow'. Resulting geometry: 487x256+1678+956 (frame: 11, 45, 11, 11, custom margin: 0, 0, 0, 0, minimum size: 377x218, maximum size: 16777215x16777215).
Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Access violation

The event type 3 was sent to QPushButton
Object tree:
QPushButton is child of
QDialogButtonBox is child of
Gui::TaskView::TaskEditControl is child of
Gui::TaskView::TaskPanel is child of
QWidget (qt_scrollarea_viewport) is child of
Gui::TaskView::TaskView is child of
QStackedWidget (qt_tabwidget_stackedwidget) is child of
QTabWidget (combiTab) is child of
Gui::DockWnd::CombiView (Combo View) is child of
QDockWidget (Combo View) is child of
Gui::MainWindow


version:
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16987 (Git)
Build type: Release
Branch: master
Hash: 5fb2dfedd122acd9ca5a68fe9e9090937df8d5fb
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
TheMarkster
Posts: 614
Joined: Thu Apr 05, 2018 1:53 am

Re: [BUG?] Crash on Datum plane

Postby TheMarkster » Sat Jun 15, 2019 4:46 am

Attaching the plane to the Part xy_plane makes it out of the allowed scope, as shown in the dependency graph. It should be attached to the body xy_plane instead. If there is a reason you wish to have a plane attached to the Part xy_plane, you could create a Part workbench plane in the Part workbench and attach it to the Part xy_plane, then create a shapebinder of the Part workbench plane, then create the part design plane and attach it to the shapebinder.
part-plane-shapebinder.png
part-plane-shapebinder.png (48.19 KiB) Viewed 152 times
chrisb
Posts: 15779
Joined: Tue Mar 17, 2015 9:14 am

Re: [BUG?] Crash on Datum plane

Postby chrisb » Sat Jun 15, 2019 8:37 am

That's right, but FreeCAD should not crash, and it doesn't on other similar occasions, like when attaching a cube to the external plane.
wmayer
Site Admin
Posts: 14279
Joined: Thu Feb 19, 2009 10:32 am

Re: [BUG?] Crash on Datum plane

Postby wmayer » Sat Jun 15, 2019 8:43 am

The actual problem is that the reference dialog doesn't handle the copy creation of axis elements (planes or lines) and thus the function TaskFeaturePick::makeCopy returns a null pointer.

The second part of the problem is that the link property then holds a null pointer which wasn't correctly handled internally. This is fixed now with git commit 588c26529.

With the above fix it still doesn't work to create a reference to the axis element of the Part container, it just fixes the crash. So, the question is how should this be handled?
chrisb
Posts: 15779
Joined: Tue Mar 17, 2015 9:14 am

Re: [BUG?] Crash on Datum plane

Postby chrisb » Sat Jun 15, 2019 9:24 am

I just tried (still with the old version) to create a ShapeBinder of the plane, which I would see as the proper solution. As it results in the same crash, I guess it will not work either in the fixed version.

I don't have a use case at hand, but I think it could be sensible to reference the coordinate system of the outer PartContainer. A workaround is easy by creating a cube in the center of the PartContainer, but it remains a workaround.
wmayer
Site Admin
Posts: 14279
Joined: Thu Feb 19, 2009 10:32 am

Re: [BUG?] Crash on Datum plane

Postby wmayer » Sat Jun 15, 2019 10:29 am

I just tried (still with the old version) to create a ShapeBinder of the plane, which I would see as the proper solution. As it results in the same crash, I guess it will not work either in the fixed version.
Currently a ShapeBinder only works if the referenced object is a Part::Feature. The axis elements are App::Plane or App::Line so the ShapeBinder won't be able to create a shape of them.

Anyway, for now I added this fix which removes a dependency if the creation of a copy fails: git commit 9177b4057
This means that the datum plane doesn't reference any more the plane of the Part container.

The next step will be to adjust TaskFeaturePick::makeCopy to create a ShapeBinder and extend the latter to also support App::Plane and App::Line.
wmayer
Site Admin
Posts: 14279
Joined: Thu Feb 19, 2009 10:32 am

Re: [BUG-FIXED] Crash on Datum plane

Postby wmayer » Sat Jun 15, 2019 1:45 pm

git commit 18183bc79 supports Origin features
git commit 5ea062f66 creates a shape binder to make a copy of an Origin feature