Menu

#11 Make Object::set, release and validate virtual

open
nobody
None
5
2019-11-22
2019-11-22
DeepSOIC
No

Hi!
When subclassing Py::Object, I found it extremely limiting that set() and release() protected methods are non-virtual. In my subclass, I wanted to fetch a pointer to C++ twin object when the object is set, and zero it out when it's released. I have hacked my way around by screening off assignment operator, but it is still a problem when trying to assign to the object through a Py::Object reference.

See https://github.com/DeepSOIC/FreeCAD-ellipse/blob/d5d3b9d1d0579940cdf967520fdbba37be6b457a/src/Base/PyHandle.h#L86 for the details.

Discussion


Log in to post a comment.