Skip to content
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

CenterOfMass: Use of already-deleted C++ object #178

Open
jes opened this issue Oct 24, 2024 · 1 comment
Open

CenterOfMass: Use of already-deleted C++ object #178

jes opened this issue Oct 24, 2024 · 1 comment

Comments

@jes
Copy link

jes commented Oct 24, 2024

I originally reported this on FreeCAD/FreeCAD#17447

Traceback (most recent call last):
  File "/home/jes/snap/freecad/common/CenterOfMass.FCMacro", line 551, in on_focusChanged
    if w is not None and w.parent() == self.solidLayout.parentWidget():
RuntimeError: Internal C++ object (PySide2.QtWidgets.QWidget) already deleted.

I'm running FreeCAD 0.21.2 on Ubuntu 24.04 from the Snap store. In that version this bug causes a segfault, but in the "latest/edge" version the segfault is fixed and the above error message appears.


I found that with a particular file (in the attached zip file sovereign-scales4.zip ), I can reliably trigger a segfault as follows:

  • delete the existing CenterOfMass item in the tree
  • make a new CenterOfMass with both of the bodies
  • click "Update" and "Save" and tick the eye make the centre of mass visible
  • open up the first sketch in the first body and delete a couple of elements
  • click the "Line" icon in the toolbar

And then FreeCAD instantly segfaults. I did try to simplify this by skipping all of the steps to do with the CenterOfMass macro but could not reproduce the problem without using CenterOfMass. I haven't exhaustively searched to find out whether every single click is necessary, but hopefully this is useful enough as a bug report.

I have a screen recording demonstrating the problem here: https://www.youtube.com/watch?v=VMFdUpOoCko

Full version info

[code]
OS: Ubuntu Core 20 (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.21.2.33771 (Git) Snap 908
Build type: Release
Branch: tag: 0.21.2
Hash: b9bfa5c5507506e4515816414cd27f4851d00489
Python 3.8.10, Qt 5.15.7, Coin 4.0.0, Vtk 7.1.1, OCC 7.6.3
Locale: English/United Kingdom (en_GB)
[/code]

Anything else?

This is the log from the terminal, including a backtrace: 100135.txt

Apart from the segfault there appears to be a use of deprecated implicit type conversion in CenterOfMass:

/home/jes/snap/freecad/common/CenterOfMass.FCMacro:307: DeprecationWarning: an integer is required (got type PySide2.QtCore.Qt.AlignmentFlag).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  label_comboUnit.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
@galou
Copy link
Collaborator

galou commented Nov 22, 2024

@s-quirin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants