Ticket #4100 - Draft "crash" when drawing bezier curve

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
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Ticket #4100 - Draft "crash" when drawing bezier curve

Post by DeepSOIC »

issue #4100

So, I tried to reproduce it. I did about two times, but I failed to make it reliably. I have however full steps that lead to a similar problem but without error message.

1. open attached file.
draft-bezcurve-test-preset.FCStd
(7.56 KiB) Downloaded 27 times
2. Go to Draft, activate Point tool.
-> task appears
3. In task, tick "Continue mode"
4. Draw some points by clicking the screen
5. Finish the tool by clicking "Close" on task
-> the last created point remains selected. Let it remain selected, it's important.
6. activate BezCurve tool
7. Click any Point object in 3d view
-> task closes. BezCurve object appears in tree view, but it has Part Cube icon to it. Also, an extra Point object appears. But no error messages in report view.
After that, attempting to use Draft, all sorts of weirdness begins, such as drawing a Bezier curve when Point tool is active, or drawing the curve even without any tool being active.

All snap modes are ON at step 7.

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17803 (Git)
Build type: Release
Branch: master
Hash: 89961a33d46063a43e9fb5b0308ca95d559eca94
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Russian/Russia (ru_RU)
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Ticket 4100 Draft "crash" when drawing bezier curve

Post by vocx »

DeepSOIC wrote: Fri Aug 30, 2019 7:52 pm 6. activate BezCurve tool
7. Click any Point object in 3d view
-> task closes. BezCurve object appears in tree view, but it has Part Cube icon to it. Also, an extra Point object appears. But no error messages in report view.
After this step, I get this message:

Code: Select all

Pick first point
Traceback (most recent call last):
  File "/opt/freecad-build-vocx/Mod/Draft/DraftGui.py", line 151, in doTasks
    f()
TypeError: _removeSwitch() missing 1 required positional argument: 'switch'
('[Draft.todo.tasks] Unexpected error:', <class 'TypeError'>, 'in ', <bound method Tracker._removeSwitch of <DraftTrackers.PlaneTracker object at 0x7f8050e84518>>, '(', None, ')')<class 'RuntimeError'>
"Pick first point" is in black, the "Traceback" message in blue, and the '([Draft.todo.tasks])' message in yellow.
After that, attempting to use Draft, all sorts of weirdness begins, such as drawing a Bezier curve when Point tool is active, or drawing the curve even without any tool being active.
Now if I keep trying to draw with the Bezier tool, I get the error message in red:

Code: Select all

Traceback (most recent call last):
  File "/opt/freecad-build-vocx/Mod/Draft/DraftTools.py", line 925, in action
    self.ui.redraw()
  File "/opt/freecad-build-vocx/Mod/Draft/DraftGui.py", line 979, in redraw
    self.checkLocal()
  File "/opt/freecad-build-vocx/Mod/Draft/DraftGui.py", line 1366, in checkLocal
    self.labelx.setText(translate("draft", "Global X"))
RuntimeError: Internal C++ object (PySide2.QtWidgets.QLabel) already deleted.
My version is

Code: Select all

OS: Ubuntu 18.04.3 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17959 +53 (Git)
Build type: Unknown
Branch: DraftFillet_improved
Hash: aa670539775d77bca3d45ff891b297ade8849298
Python version: 3.6.8
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
It's my own branch, which has a few bits of additional code, but nothing that would cause this problem. I'm basically using the latest master branch git commit 0641ca0d1e. The main difference that I can see is that your Qt is 5.12 and mine is Qt 5.9.

The error messages seem to be during establishing the tracker of the spline, or something around that DraftTrackers.PlaneTracker.
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.
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Ticket #4100 - Draft "crash" when drawing bezier curve

Post by carlopav »

Could it be something I messed up when adding possibility to draw a bezier curve with fixed degree?... I'm out of home till next week, I'll check this asap...
follow my experiments on BIM modelling for architecture design
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Ticket #4100 - Draft "crash" when drawing bezier curve

Post by DeepSOIC »

carlopav wrote: Sun Sep 01, 2019 7:09 pm Could it be something I messed up when adding possibility to draw a bezier curve with fixed degree?
Unlikely, as in the Russian thread (https://forum.freecadweb.org/viewtopic.php?f=29&t=38955), cynabr reports that the bug is even in v0.16.
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Ticket #4100 - Draft "crash" when drawing bezier curve

Post by carlopav »

Uff .. I was scared it was my fault :? .. I'll check it anyway asap
follow my experiments on BIM modelling for architecture design
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Ticket #4100 - Draft "crash" when drawing bezier curve

Post by vocx »

DeepSOIC wrote: Sun Sep 01, 2019 8:02 pm ... cynabr reports that the bug is even in v0.16.
If this is true, then it's possibly a hard to trigger bug, which is why it hasn't been addressed in a long time. I personally think that it's weird to trigger it in the way described by the first post. The spline can be attached directly to the grid, so there is no need to create the points in the first place.

The bug is probably somewhere in the Spline code that handles the scene view, and the creation or destruction of the trackers. So we'd need to take a look that these functions are triggered in the right order, and that they don't try to use already destroyed objects.
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.
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Ticket #4100 - Draft "crash" when drawing bezier curve

Post by carlopav »

Perhaps this can be related to a problem I spotted with the Draft Point when using continue mode:
if I draw several point in continue mode, and click close, the command does not finish, but let me add another point.
So if I click close and select another tool, i produce an error. This happens always in:

Code: Select all

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21349 (Git)
Build type: Release
Branch: master
Hash: 28222fe066b60ae5c99dce4e5b022d270cad250f
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Italian/Italy (it_IT)
follow my experiments on BIM modelling for architecture design
Post Reply