crash on selecting TD element in tree when page not shown

Discussions about the development of the TechDraw workbench
User avatar
uwestoehr
Posts: 1366
Joined: Sun Jan 27, 2019 3:21 am

crash on selecting TD element in tree when page not shown

Postby uwestoehr » Fri Feb 14, 2020 12:39 am

- open this example file:
Cube.FCStd
testfile
(39.51 KiB) Downloaded 7 times

As you can see the page is not shown. This is important to reproduce the crash.

- double click in the tree on the entry "LeaderLine"

result: you get this error:

Code: Select all

Illegal storage access...
<Exception> Illegal storage access! Please save your work under a new file name and restart the application!
Afterwards FC will crash sooner or later.

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19570 (Git)
Build type: Release
Branch: master
Hash: 53bbf09bf9a624428808c2d528949092adb6fdbf
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
chrisb
Posts: 22526
Joined: Tue Mar 17, 2015 9:14 am

Re: crash on selecting TD element in tree when page not shown

Postby chrisb » Fri Feb 14, 2020 6:18 am

Confirmed, crashes here immediately.

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19541 (Git)
Build type: Release
Branch: master
Hash: a797a4172709b82c6cd08dcf6df86cb789aaa3ce
Python version: 3.8.1
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/Germany (en_DE)
vocx
Posts: 3341
Joined: Thu Oct 18, 2018 9:18 pm

Re: crash on selecting TD element in tree when page not shown

Postby vocx » Sat Feb 15, 2020 5:46 am

I also get immediate crash.

I guess the problem is in TaskLeaderLine.cpp with TechDrawGui::ViewProviderLeader.

I'm on 0.19.19591.

Code: Select all

Thread 1 "FreeCAD" received signal SIGSEGV, Segmentation fault.
0x00007fff551361ae in TechDrawGui::TaskLeaderLine::TaskLeaderLine (this=0x55555b72ed50, leadVP=0x555555e60640)
    at /opt/freecad-source-vocx/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp:110
110	    m_scene = m_mdi->m_scene;
(gdb) bt
#0  0x00007fff551361ae in TechDrawGui::TaskLeaderLine::TaskLeaderLine(TechDrawGui::ViewProviderLeader*) (this=0x55555b72ed50, leadVP=0x555555e60640) at /opt/freecad-source-vocx/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp:110
#1  0x00007fff55139ae2 in TechDrawGui::TaskDlgLeaderLine::TaskDlgLeaderLine(TechDrawGui::ViewProviderLeader*) (this=
    0x55555b5d3160, leadVP=0x555555e60640) at /opt/freecad-source-vocx/src/Mod/TechDraw/Gui/TaskLeaderLine.cpp:770
#2  0x00007fff55218ff5 in TechDrawGui::ViewProviderLeader::setEdit(int) (this=0x555555e60640, ModNum=0)
    at /opt/freecad-source-vocx/src/Mod/TechDraw/Gui/ViewProviderLeader.cpp:101
#3  0x00007fff5521909c in TechDrawGui::ViewProviderLeader::doubleClicked() (this=0x555555e60640)
    at /opt/freecad-source-vocx/src/Mod/TechDraw/Gui/ViewProviderLeader.cpp:123
#4  0x00007ffff6e1489a in Gui::TreeWidget::mouseDoubleClickEvent(QMouseEvent*) (this=0x555555e638d0, event=0x7fffffffc950)
    at /opt/freecad-source-vocx/src/Gui/Tree.cpp:1314
#5  0x00007ffff38cd95f in QWidget::event(QEvent*) (this=this@entry=0x555555e638d0, event=event@entry=0x7fffffffc950)
    at kernel/qwidget.cpp:8904
#6  0x00007ffff396e4de in QFrame::event(QEvent*) (this=0x555555e638d0, e=0x7fffffffc950) at widgets/qframe.cpp:550
#7  0x00007ffff3ae1b8b in QAbstractItemView::viewportEvent(QEvent*) (this=this@entry=0x555555e638d0, event=event@entry=0x7fffffffc950) at itemviews/qabstractitemview.cpp:1748
#8  0x00007ffff3b4a52c in QTreeView::viewportEvent(QEvent*) (this=0x555555e638d0, event=0x7fffffffc950)
    at itemviews/qtreeview.cpp:1326
#9  0x00007ffff2b105bc in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) (receiver=receiver@entry=0x555555e01db0, event=event@entry=0x7fffffffc950) at kernel/qcoreapplication.cpp:1135
#10 0x00007ffff388e815 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=this@entry=
    0x5555559dac10, receiver=receiver@entry=0x555555e01db0, e=e@entry=0x7fffffffc950) at kernel/qapplication.cpp:3718
#11 0x00007ffff389665f in QApplication::notify(QObject*, QEvent*) (this=<optimized out>, receiver=0x555555e01db0, e=0x7fffffffc950)
    at kernel/qapplication.cpp:3198
---Type <return> to continue, or q <return> to quit---
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: paypal.
User avatar
uwestoehr
Posts: 1366
Joined: Sun Jan 27, 2019 3:21 am

Re: crash on selecting TD element in tree when page not shown

Postby uwestoehr » Sat Feb 15, 2020 4:03 pm

Thanks for confirmation. This is now issue #4266.
User avatar
wandererfan
Posts: 3674
Joined: Tue Nov 06, 2012 5:42 pm

Re: crash on selecting TD element in tree when page not shown

Postby wandererfan » Mon Feb 17, 2020 12:17 am

uwestoehr wrote:
Sat Feb 15, 2020 4:03 pm
Thanks for confirmation. This is now issue #4266.
Should be fixed bygit commit e8417c6268.
vocx
Posts: 3341
Joined: Thu Oct 18, 2018 9:18 pm

Re: crash on selecting TD element in tree when page not shown

Postby vocx » Mon Feb 17, 2020 6:22 am

wandererfan wrote:
Mon Feb 17, 2020 12:17 am
Should be fixed bygit commit e8417c6268.
It was already merged. So I tested again, and no crash with 0.19.19624.
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: paypal.
User avatar
uwestoehr
Posts: 1366
Joined: Sun Jan 27, 2019 3:21 am

Re: crash on selecting TD element in tree when page not shown

Postby uwestoehr » Mon Feb 17, 2020 11:15 am

wandererfan wrote:
Mon Feb 17, 2020 12:17 am
Should be fixed bygit commit e8417c6268.
Many thanks! The crash is gone but the behavior differs from what is written in the Wiki. Here a list of issues I noted:

- one cannot add a leader and then select the Base View it should be attached to
- when selecting a view first and then adding a leader one can later also not change the Base View. I think this is sensible. I only wondered that I cannot find a case where the Base View Combobox is active in the dialog.

- when selecting 2 points to draw a line the result is always a horizontal line, not the line one has drawn:
YHq6CG45jH.gif
screencast of the line selection issue
YHq6CG45jH.gif (101.48 KiB) Viewed 155 times

Maybe the drawing style guidelines require horizontal lines but then the second point pick must be horizontal to the first one.

- insert an annotation, select it and add a leader line to it
result: the leader line appears in the tree not under the annotation:
FreeCAD_tUbj4pfk0o.png
tree view
FreeCAD_tUbj4pfk0o.png (5.07 KiB) Viewed 155 times

- if you haven't picked any point on creation time, you can later not add points -> you must create a new leader instead
User avatar
wandererfan
Posts: 3674
Joined: Tue Nov 06, 2012 5:42 pm

Re: crash on selecting TD element in tree when page not shown

Postby wandererfan » Mon Feb 17, 2020 2:07 pm

uwestoehr wrote:
Mon Feb 17, 2020 11:15 am
- one cannot add a leader and then select the Base View it should be attached to
- when selecting a view first and then adding a leader one can later also not change the Base View. I think this is sensible. I only wondered that I cannot find a case where the Base View Combobox is active in the dialog.
Didn't think it was possible to create a leader without a base view using the Gui. Are you using Python?
The BaseView field is display only. I guess it could be modifiable.
- when selecting 2 points to draw a line the result is always a horizontal line, not the line one has drawn: YHq6CG45jH.gif
AutoHorizontal property?
- insert an annotation, select it and add a leader line to it
result: the leader line appears in the tree not under the annotation: FreeCAD_tUbj4pfk0o.png
if you make a leader, then add an annotation, does the tree look right? Don't think annotation knows how to handle children.
- if you haven't picked any point on creation time, you can later not add points -> you must create a new leader instead
Knew about this one. It's on my list but I don't know when I'll get to it.
User avatar
uwestoehr
Posts: 1366
Joined: Sun Jan 27, 2019 3:21 am

Re: crash on selecting TD element in tree when page not shown

Postby uwestoehr » Mon Feb 17, 2020 6:46 pm

wandererfan wrote:
Mon Feb 17, 2020 2:07 pm
Didn't think it was possible to create a leader without a base view using the Gui. Are you using Python?
The BaseView field is display only.
OK, then I'll try to change the dialog to make it more clear it is a display. I don't use Python.
- when selecting 2 points to draw a line the result is always a horizontal line, not the line one has drawn: YHq6CG45jH.gif
AutoHorizontal property?
Yes, but this is what I mean - the user explicitly sets the points as he did, therefore the AutoHorizontal should not by default be enabled in the preferences. If the user needs this for a certain leaders he can do this or he can set the preferences option. Then he know what is going on.
-> I'll make a PR
Don't think annotation knows how to handle children.
The question is if this can be changed. It is not an important point but I think all TD elements should be able to handle children in future.
- if you haven't picked any point on creation time, you can later not add points -> you must create a new leader instead
Knew about this one. It's on my list but I don't know when I'll get to it.
OK.
User avatar
wandererfan
Posts: 3674
Joined: Tue Nov 06, 2012 5:42 pm

Re: crash on selecting TD element in tree when page not shown

Postby wandererfan » Mon Feb 17, 2020 9:18 pm

uwestoehr wrote:
Mon Feb 17, 2020 6:46 pm
Yes, but this is what I mean - the user explicitly sets the points as he did, therefore the AutoHorizontal should not by default be enabled in the preferences. If the user needs this for a certain leaders he can do this or he can set the preferences option. Then he know what is going on.
-> I'll make a PR
There is already a preference for it, but it needs to be added to the preference screens.

Code: Select all

    Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->
                                         GetGroup("Preferences")->GetGroup("Mod/TechDraw/LeaderLines");
    bool result = hGrp->GetBool("AutoHorizontal",true);