Ticket #4140: Crash on Select All (Ctrl+A)

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
DeepSOIC
Posts: 7056
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Ticket #4140: Crash on Select All (Ctrl+A)

Postby DeepSOIC » Sat Sep 21, 2019 4:32 pm

1. open attached file
selectall-crasher.FCStd
(11.25 KiB) Downloaded 6 times
2. click empty space in model tree (interestingly, this step is important)
3. Hit Ctrl+A
->
Illegal storage access...
Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Illegal storage access! Please save your work under a new file name and restart the application!
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18234 (Git)
Build type: Release
Branch: master
Hash: 3af5d97e9b2a60823815f662aba25422c4bc45bb
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)
Last edited by DeepSOIC on Sat Sep 21, 2019 5:37 pm, edited 1 time in total.
User avatar
DeepSOIC
Posts: 7056
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Crash on Select All (Ctrl+A)

Postby DeepSOIC » Sat Sep 21, 2019 4:54 pm

Narrowed it down a bit.
1. new doc
2. add two Part primitives
3. Union them
4. expand Union in tree
5. Ctrl+A

Instead of 5, I can also trigger the crash by box-selecting in tree view so that the selection includes "Unnamed". Or select the bottom-most entry and hit Shift+Arrow Up, and at the moment I try including Unnamed in the selection, I get that Illegal Storage Access error.
kisolre
Posts: 1360
Joined: Wed Nov 21, 2018 1:13 pm

Re: Crash on Select All (Ctrl+A)

Postby kisolre » Sat Sep 21, 2019 5:03 pm

Happens here with same version. Another thing is that if after that I close only the file (not FreeCAD) then create new file and add primitives selecting them in tree view does not actually select them. They dont appear in SelectionView and no tools become active. Selecting from 3d view shows in selection view and tools become active but does not show as selected in tree view.
chrisb
Posts: 18991
Joined: Tue Mar 17, 2015 9:14 am

Re: Crash on Select All (Ctrl+A)

Postby chrisb » Sat Sep 21, 2019 5:26 pm

Confirmed. So it is not system dependent.

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18095 (Git)
Build type: Release
Branch: master
Hash: 27cb54009b57c1938f7ff97026c8b35c1688233f
Python version: 3.7.3
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Germany (en_DE)
User avatar
DeepSOIC
Posts: 7056
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Crash on Select All (Ctrl+A)

Postby DeepSOIC » Sat Sep 21, 2019 5:37 pm

vocx
Posts: 1687
Joined: Thu Oct 18, 2018 9:18 pm

Re: Ticket #4140: Crash on Select All (Ctrl+A)

Postby vocx » Sun Sep 22, 2019 7:16 am

DeepSOIC wrote:
Sat Sep 21, 2019 4:54 pm
Narrowed it down a bit.
1. new doc
2. add two Part primitives
3. Union them
4. expand Union in tree
5. Ctrl+A

Instead of 5, I can also trigger the crash by box-selecting in tree view so that the selection includes "Unnamed". Or select the bottom-most entry and hit Shift+Arrow Up, and at the moment I try including Unnamed in the selection, I get that Illegal Storage Access error.
This is the backtrace

Code: Select all

Thread 1 "FreeCAD" received signal SIGSEGV, Segmentation fault.
0x00007ffff6cf47cf in QTreeWidgetItem::setSelected (this=0x4104000000, aselect=false)
    at /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qtreewidget.h:395
395	{ if (view) view->setItemSelected(this, aselect); }
(gdb) bt
#0  0x00007ffff6cf47cf in QTreeWidgetItem::setSelected(bool) (this=0x4104000000, aselect=false)
    at /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qtreewidget.h:395
#1  0x00007ffff6e0fa98 in Gui::TreeWidget::onItemSelectionChanged() (this=0x555556277170)
    at /opt/freecad-source-vocx/src/Gui/Tree.cpp:2701
#2  0x00007ffff6e1f504 in Gui::TreeWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x555556277170, _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0x7fffffffba70) at /opt/freecad-build-vocx/src/Gui/moc_Tree.cpp:169
#3  0x00007ffff2c72645 in QMetaObject::activate(QObject*, int, int, void**) (sender=sender@entry=0x555556277170, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=9, argv=argv@entry=0x0) at kernel/qobject.cpp:3767
#4  0x00007ffff2c72d17 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=sender@entry=0x555556277170, m=m@entry=0x7ffff40a77c0 <QTreeWidget::staticMetaObject>, local_signal_index=local_signal_index@entry=9, argv=argv@entry=0x0)
    at kernel/qobject.cpp:3629
#5  0x00007ffff3c80ec3 in QTreeWidget::itemSelectionChanged() (this=this@entry=0x555556277170) at .moc/moc_qtreewidget.cpp:445
#6  0x00007ffff3c840d0 in QTreeWidgetPrivate::_q_selectionChanged(QItemSelection const&, QItemSelection const&) (this=<optimized out>, selected=..., deselected=...) at itemviews/qtreewidget.cpp:2333
#7  0x00007ffff2c72645 in QMetaObject::activate(QObject*, int, int, void**) (sender=sender@entry=0x55555625ae80, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffbc10) at kernel/qobject.cpp:3767
#8  0x00007ffff2c72d17 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=sender@entry=0x55555625ae80, m=m@entry=0x7ffff30fb9e0 <QItemSelectionModel::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffbc10)
    at kernel/qobject.cpp:3629
#9  0x00007ffff2bef627 in QItemSelectionModel::selectionChanged(QItemSelection const&, QItemSelection const&) (this=this@entry=0x55555625ae80, _t1=..., _t2=...) at .moc/moc_qitemselectionmodel.cpp:479
#10 0x00007ffff2bf44d5 in QItemSelectionModel::emitSelectionChanged(QItemSelection const&, QItemSelection const&) (this=this@entry=0x55555625ae80, newSelection=..., oldSelection=...) at itemmodels/qitemselectionmodel.cpp:1902
---Type <return> to continue, or q <return> to quit---
#11 0x00007ffff2bf7093 in QItemSelectionModel::select(QItemSelection const&, QFlags<QItemSelectionModel::SelectionFlag>) (this=0x55555625ae80, selection=..., command=...) at itemmodels/qitemselectionmodel.cpp:1336
#12 0x00007ffff3c78fa1 in QTreeViewPrivate::select(QModelIndex const&, QModelIndex const&, QFlags<QItemSelectionModel::SelectionFlag>) (this=this@entry=0x55555624c7a0, topIndex=..., bottomIndex=..., command=..., command@entry=...) at itemviews/qtreeview.cpp:3880
#13 0x00007ffff3c79855 in QTreeView::selectAll() (this=<optimized out>) at itemviews/qtreeview.cpp:2678
#14 0x00007ffff3c0f4dd in QAbstractItemView::keyPressEvent(QKeyEvent*) (this=this@entry=0x555556277170, event=event@entry=0x7fffffffcc90)
    at itemviews/qabstractitemview.cpp:2481
#15 0x00007ffff3c7deeb in QTreeView::keyPressEvent(QKeyEvent*) (this=0x555556277170, event=0x7fffffffcc90) at itemviews/qtreeview.cpp:2026
#16 0x00007ffff6e032b3 in Gui::TreeWidget::keyPressEvent(QKeyEvent*) (this=0x555556277170, event=0x7fffffffcc90)
    at /opt/freecad-source-vocx/src/Gui/Tree.cpp:1275
#17 0x00007ffff3a00877 in QWidget::event(QEvent*) (this=this@entry=0x555556277170, event=event@entry=0x7fffffffcc90)
    at kernel/qwidget.cpp:8933
#18 0x00007ffff3aa14de in QFrame::event(QEvent*) (this=this@entry=0x555556277170, e=e@entry=0x7fffffffcc90) at widgets/qframe.cpp:550
#19 0x00007ffff3aaa623 in QAbstractScrollArea::event(QEvent*) (this=this@entry=0x555556277170, e=e@entry=0x7fffffffcc90)
    at widgets/qabstractscrollarea.cpp:1168
#20 0x00007ffff3c1487b in QAbstractItemView::event(QEvent*) (this=0x555556277170, event=0x7fffffffcc90)
    at itemviews/qabstractitemview.cpp:1680
...
The error seems to be in the Gui::TreeWidget::onItemSelectionChanged() function.

Code: Select all

(gdb) bt full 3
#0  0x00007ffff6cf47cf in QTreeWidgetItem::setSelected(bool) (this=0x4104000000, aselect=false)
    at /usr/include/x86_64-linux-gnu/qt5/QtWidgets/qtreewidget.h:395
#1  0x00007ffff6e0fa98 in Gui::TreeWidget::onItemSelectionChanged() (this=0x555556277170)
    at /opt/freecad-source-vocx/src/Gui/Tree.cpp:2701
        item = 0x55555b72e810
        it = {i = 0x7fffd800d220}
        lock = false
        selItems = 
            {<QListSpecialMethods<QTreeWidgetItem*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7fffd800d200}, d = 0x7fffd800d200}}
        itDoc = {i = 0x7fffd800d230}
        itObj = {i = 0x7fffd800d220}
#2  0x00007ffff6e1f504 in Gui::TreeWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=0x555556277170, _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0x7fffffffba70) at /opt/freecad-build-vocx/src/Gui/moc_Tree.cpp:169
        _t = 0x555556277170
#3  0x00007ffff2c72645 in QMetaObject::activate(QObject*, int, int, void**) (sender=sender@entry=0x555556277170, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=9, argv=argv@entry=0x0) at kernel/qobject.cpp:3767
        method_relative = 17
        callFunction = 0x7ffff6e1f34a <Gui::TreeWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>
        receiver = 0x555556277170
        receiverInSameThread = <optimized out>
        sw = 
---Type <return> to continue, or q <return> to quit---
          {receiver = 0x555556277170, previousSender = 0x7fffffffbba0, currentSender = {sender = 0x555556277170, signal = 25, ref = 1}, switched = true}
        c = 0x5555561a0500
        last = 0x5555561a0500
        locker = {val = 140737271313600}
        connectionLists = {connectionLists = 0x5555561848b0}
        list = <optimized out>
        currentThreadId = 0x7ffff7f71780
        signal_index = 25
        empty_argv = {0x0}
I suspect it is something from realthunder's changes, since he's been working and re-working the selection and the tree view.

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.18272 (Git)
Build type: Debug
Branch: master
Hash: 88637aeb202b481a16cbd82c8767a0cc2745cfe1
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)