View Issue Details

IDProjectCategoryView StatusLast Update
0001031FreeCADBugpublic2013-11-04 22:53
Reportercrashfridh Assigned To 
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSDebianOS VersionUnstable
Fixed in Version0.14 
Summary0001031: PropertyLinkSubList causes crash
DescriptionWhenever a PropertyLinkSubList is called it results in a Segmentation Fault.
TagsNo tags attached.
FreeCAD Information

Activities

crashfridh

2013-02-26 13:53

reporter   ~0002944

happens with 0.13, 1880

wmayer

2013-02-26 16:25

administrator   ~0002945

A bit more information would be helpful. What do you mean with "calling" a PropertyLinkSubList? Do you have some example code?

2013-02-27 01:45

 

propertylinksublist.py (Attachment missing)

crashfridh

2013-02-27 01:46

reporter   ~0002948

Last edited: 2013-02-27 02:46

See propertylinksublist.py attached. When obj2.Spectrum is called (in this case via print) it results in a segmentation fault.

Note that I forgot obj.Proxy = self in both objects, though that doesn't matter in this case.

---
Also, I could imagine that in the background it uses a PropertyLinkSub? This one doesn't seem to be functioning, just returning the tuple when the property is called instead of the value it should be pointing to.

As a test, replace the SubList with just a Sub and see.

wmayer

2013-03-03 13:17

administrator   ~0002960

OK, I can confirm the crash and fixed it. But note, your usage of the PropertyLinkSubList is wrong. It is expected that there is a 1:1 binding of object and string, i.e. the property wants the same size of objects than strings.

And thus you have to meet this conditions:
* The object assigned to Spectrum must be either a list or tuple (which is correct)
* Inside the the list or tuple you must have either a flat hierarchy and then object and string must alternate e.g. [obj1, "sub1", obj2, "sub2", ...]
or have grouped the objects into a 2-tuple e.g. [(obj1, "sub1"), (obj2, "sub2"), ...]

So, in your example you have to write:
obj.Spectrum = (master, 'Spectrum')

wmayer

2013-03-03 13:18

administrator   ~0002961

git show 676583e

crashfridh

2013-03-14 13:16

reporter   ~0002982

Last edited: 2013-03-15 03:40

See the example attached to this issue.

When I use a PropertyLinkSubList and call obj2.Spectrum I get [(<Python feature object>, 'Spectrum')] while I would expect to see the value it points to, that is the value assigned to obj1.Spectrum

when I use a PropertyLinkSub instead I get

  File "./propertylinksublist.py", line 20, in __init__
    obj.Spectrum = (master, 'Spectrum')
AttributeError: Unknown error in attribute Spectrum

This happens in the revision in which it was supposedly fixed as well as in master.
Could you describe what the expected behaviour is of these properties, since I might be that I expect something else to happen.


Edit:
Just read in PropertyLinks.h the following:

/** the Link Poperty with sub elements
 * This property links a object and a defined sequence of
 * sub elements. This subelemts (like Edges of a Shape)
 * are stored as names, which can be resolved by the
 * ComplexGeoDataType interface to concrete sub objects.
 */

Would it make more sense to 'hide' the necessity to use ComplexGeoDataType when calling a PropertyLinkSub from Python, and just return the value it points to as I wrote further up.

wmayer

2013-10-28 12:12

administrator   ~0003822

> When I use a PropertyLinkSubList and call obj2.Spectrum I get [(<Python feature object>, 'Spectrum')] while I would expect to see the value it points to, that is the value assigned to obj1.Spectrum

If we did this there would be a certain loss of information. Knowing that a certain property of an object is referenced is more information than just the data. It's up to the other object to get the data if needed.

> AttributeError: Unknown error in attribute Spectrum
Actually not a correct usage. But to ease the use this syntax is supported too now.

> Would it make more sense to 'hide' the necessity to use ComplexGeoDataType when calling a PropertyLinkSub from Python, and just return the value it points to as I wrote further up.

Definitely not!

wmayer

2013-10-28 12:15

administrator   ~0003823

git show da515ef

Related Changesets

FreeCAD: master c75903c9

2013-10-28 11:14:11

wmayer

Details Diff
0001031: PropertyLinkSubList causes crash Affected Issues
0001031
mod - src/App/PropertyLinks.cpp Diff File

Issue History

Date Modified Username Field Change
2013-02-26 13:41 crashfridh New Issue
2013-02-26 13:53 crashfridh Note Added: 0002944
2013-02-26 16:25 wmayer Note Added: 0002945
2013-02-27 01:45 crashfridh File Added: propertylinksublist.py
2013-02-27 01:46 crashfridh Note Added: 0002948
2013-02-27 02:00 crashfridh Note Edited: 0002948
2013-02-27 02:46 crashfridh Note Edited: 0002948
2013-03-03 13:17 wmayer Note Added: 0002960
2013-03-03 13:18 wmayer Note Added: 0002961
2013-03-03 13:18 wmayer Status new => closed
2013-03-03 13:18 wmayer Resolution open => fixed
2013-03-03 13:18 wmayer Fixed in Version => 0.14
2013-03-14 13:16 crashfridh Note Added: 0002982
2013-03-14 13:16 crashfridh Status closed => feedback
2013-03-14 13:16 crashfridh Resolution fixed => reopened
2013-03-15 03:40 crashfridh Note Edited: 0002982
2013-10-28 12:12 wmayer Note Added: 0003822
2013-10-28 12:15 wmayer Note Added: 0003823
2013-10-28 12:15 wmayer Status feedback => closed
2013-10-28 12:15 wmayer Resolution reopened => fixed
2013-11-04 22:53 yorik Changeset attached => FreeCAD Master master c75903c9