View Issue Details

IDProjectCategoryView StatusLast Update
0004649FreeCADBugpublic2021-12-09 17:48
Reportersuzanne.soy Assigned Towmayer  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Platformx86_64OSLinuxOS VersionUbuntu 20.04
Product Version0.19 
Fixed in Version0.20 
Summary0004649: Segmentation fault when clearing an expression in an onChanged handler
Descriptionhttps://forum.freecadweb.org/viewtopic.php?f=22&t=58247

Segmentation fault when clearing an expression in an onChanged handler
Steps To Reproduce
  • Open FreeCAD
  • Paste the following in the Python console and press Return (twice if needed)
  • 
    if True:
        App.newDocument("Document")
        obj = App.ActiveDocument.addObject("App::DocumentObjectGroupPython", "Obj")
        class Cls():
            def __init__(self, obj):
                self.MonitorChanges = False
                obj.Proxy = self
                obj.addProperty('App::PropertyFloat', "propA", "group")
                obj.addProperty('App::PropertyFloat', "propB", "group")
                self.MonitorChanges = True
                obj.setExpression("propB", '6*9')
            def onChanged(self, obj, prop):
                print("onChanged",self, obj, prop)
                if (self.MonitorChanges and prop == "propA"):
                    print('Removing expression...')
                    obj.setExpression("propB", None)
        Cls(obj)
    
    
    
  • Click on the "Obj" object that was created
  • Click on the "prop A" property
  • type "=42" (which opens the formula editor)
  • press Return twice
  • FreeCAD crashes (backtrace at the end of this post)
Additional Information

Program received signal SIGSEGV, Segmentation fault.
#0  /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7f1dbb0e6210]
#1  0x7f1dbcf53cd4 in App::Expression::getPyValue() const from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libFreeCADApp.so+0x34
0000002  0x7f1dbcf54448 in App::Expression::getValueAsAny() const from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libFreeCADApp.so+0x38
0000003  0x7f1dbd0598d3 in App::PropertyExpressionEngine::execute(App::PropertyExpressionEngine::ExecuteOption, bool*) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libFreeCADApp.so+0x233
0000004  0x7f1dbce76667 in App::Document::_recomputeFeature(App::DocumentObject*) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libFreeCADApp.so+0x147
0000005  0x7f1dbced1dd6 in App::Document::recompute(std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> > const&, bool, bool*, int) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libFreeCADApp.so+0x5c6
0000006  0x7f1dbdc47b61 in Gui::PropertyEditor::PropertyEditor::recomputeDocument(App::Document*) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libFreeCADGui.so+0x81
0000007  0x7f1dbdc47c22 in Gui::PropertyEditor::PropertyEditor::closeTransaction() from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libFreeCADGui.so+0x92
0000008  0x7f1dbdc4c24e in Gui::PropertyEditor::PropertyEditor::closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libFreeCADGui.so+0x3e
0000009  /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libQt5Widgets.so.5(+0x2f84ff) [0x7f1dbbf8c4ff]
0000010  0x7f1dbb5f8a18 in QMetaObject::activate(QObject*, int, int, void**) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libQt5Core.so.5+0x6c0
0000011  0x7f1dbbf997f4 in QAbstractItemDelegate::closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libQt5Widgets.so.5+0x40
0000012  0x7f1dbb5f7594 in QObject::event(QEvent*) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libQt5Core.so.5+0xbc
0000013  0x7f1dbbe087f2 in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libQt5Widgets.so.5+0xdc
0000014  0x7f1dbbe0e31d in QApplication::notify(QObject*, QEvent*) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libQt5Widgets.so.5+0x1ac9
0000015  0x7f1dbd9b8df9 in Gui::GUIApplication::notify(QObject*, QEvent*) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libFreeCADGui.so+0x89
0000016  0x7f1dbb5e2606 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libQt5Core.so.5+0x86
0000017  0x7f1dbb5e283e in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libQt5Core.so.5+0x1da
0000018  /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libQt5Core.so.5(+0x1dc54c) [0x7f1dbb61154c]
0000019  /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/./libglib-2.0.so.0(g_main_context_dispatch+0x27d) [0x7f1db852b23d]
0000020  /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/./libglib-2.0.so.0(+0x554d1) [0x7f1db852b4d1]
0000021  /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/./libglib-2.0.so.0(g_main_context_iteration+0x31) [0x7f1db852b571]
0000022  0x7f1dbb6110e8 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libQt5Core.so.5+0x5e
0000023  0x7f1dbb5df019 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libQt5Core.so.5+0x187
0000024  0x7f1dbb5e2e8f in QCoreApplication::exec() from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libQt5Core.so.5+0xfd
0000025  0x7f1dbd942926 in Gui::Application::runApplication() from /tmp/.mount_FreeCAm4IC5c/usr/bin/../lib/libFreeCADGui.so+0x15f6
0000026  /tmp/.mount_FreeCAm4IC5c/usr/bin/freecad(+0x44bf) [0x564432e404bf]
0000027  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f1dbb0c70b3]
0000028  /tmp/.mount_FreeCAm4IC5c/usr/bin/freecad(+0x47d9) [0x564432e407d9]
TagsNo tags attached.
FreeCAD InformationOS: Ubuntu 20.04.2 LTS (wayfire)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.19.2)
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United Kingdom (en_GB)

Issue History

Date Modified Username Field Change
2021-04-30 22:06 suzanne.soy New Issue
2021-12-09 15:41 wmayer Status new => confirmed
2021-12-09 17:22 wmayer Note Added: 0016073
2021-12-09 17:48 wmayer Assigned To => wmayer
2021-12-09 17:48 wmayer Status confirmed => closed
2021-12-09 17:48 wmayer Resolution open => fixed
2021-12-09 17:48 wmayer Fixed in Version => 0.20
2021-12-09 17:48 wmayer Note Added: 0016074