-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sketcher segfaults when using the symmetry tool #13999
Comments
This is truly unclear. I don't know how to reproduce the bug. Could you record a video? |
May be related to #13915? |
It's literally grabbing those four lines and creating a symmetry across the construction line. I'll try to upload a video as soon as I can. Update: video added to the description (thanks @xtemp09 for the heads up) |
I cannot reproduce. OS: Ubuntu 22.04.3 LTS (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.37303 (Git)
Build type: Debug
Branch: main
Hash: 869cb1f83b5f92ee134dafde46c9c5e0dceb8889
Python 3.10.12, Qt 5.15.12, Coin 4.0.0, Vtk 9.1.0, OCC 7.5.1
Locale: English/United States (en_US) |
Thanks for testing. I can still reproduce it, unfortunately. A few notes:
|
@PaddleStroke FYI could this be related to #13943 |
This issue is not related to #13915. The crash occurs inside afterHandlerModeChanged() at line 463 because of a heap-use-after-free error. |
The issue is a bit more complex. The DrawSketchHandlerSymmetry purges itself after the click (by calling ViewProviderSketch::deactivateHandler()). So, it will be destroyed inside a member function but then still accesses a member variable which of course causes a segmentation fault. The relevant stacktrace after the click into the 3D view is:
One of the calling instances of the stack is still DrawSketchControllableHandler::onModeChanged and after the self-destruction it accesses |
Do you have a solution in mind? Is it possible to have
|
The logic of the sketch handlers is somewhat convoluted because the view provider has a pointer to it and the handler has a pointer to the sketch. Then, the handler passes itself as argument to one of its members. This makes it difficult to understand the whole ownership.
Should work.
I thought about removing the line to destroy the handler inside deactivateHandler() but set a flag that it's deactivated. Then the uppermost calling instance (in this case ViewProviderSketch::mouseButtonPressed) checks if the handler is deactivated and destroys it. However, this may require some more changes to make it working for every handler type. |
Is there an existing issue for this?
Problem description
Steps to reproduce:
Sketch
sketch on the tree viewTasks
panel, underElements
, select the last four lines (50-Line
,51-Line
,52-Line
,53-Line
)Sketcher_Symmetry
) on the toolbar49-Line
) as the axis of symmetrySymmetry.segfault.webm
Full version info
Subproject(s) affected?
Sketcher
Anything else?
File to reproduce
Segmentation fault
Code of Conduct
The text was updated successfully, but these errors were encountered: