Imported from Redmine: http://hub.qgis.org/issues/777
Author: @rduivenvoorde rduivenvoorde@foo.bar (Q: should we show email?, Q: should we create @ mention?)
Description
When a feature is destroyed, if it has ownership over a geometry, it deletes that geometry. After that point, if one tries to call functions on the geometry, it will return nulls (Linux) or cause a KERN_PROTECTION_FAILURE (OS X).
This can be reproduced by selecting a feature, then typing the following into the Python console:
(Sometimes it requires calling it twice to reproduce the crash -- however, it will never return the correct answer.)
The reason for this appears to be that the feature created when it is pulled out of the list is then destoryed before exportToWkt() is called, taking the geometry with it.
A workaround is to instead call geometryAndOwnership(), which tells the feature to not destroy the geometry.
It seems like this problem may actually be exportGeosToWkb -- functions like wkbType() fail in the same way. It's possible that the mGeometry check at the beginning of these functions needs to move before teh exportGeosToWkb(), or that the exportGeosToWkb() needs to more resilient against being deleted.
Q: this issue has relations to other issues (IN FUTURE), so these can be handled when those are added?
As example: http://hub.qgis.org/issues/10755
Imported from Redmine: http://hub.qgis.org/issues/777 Author: @rduivenvoorde rduivenvoorde@foo.bar (Q: should we show email?, Q: should we create @ mention?)
Description
When a feature is destroyed, if it has ownership over a geometry, it deletes that geometry. After that point, if one tries to call functions on the geometry, it will return nulls (Linux) or cause a KERN_PROTECTION_FAILURE (OS X).
This can be reproduced by selecting a feature, then typing the following into the Python console:
iface.activeLayer().selectedFeatures()r0.geometry().exportToWkt()
(Sometimes it requires calling it twice to reproduce the crash -- however, it will never return the correct answer.)
The reason for this appears to be that the feature created when it is pulled out of the list is then destoryed before exportToWkt() is called, taking the geometry with it.
A workaround is to instead call geometryAndOwnership(), which tells the feature to not destroy the geometry.
It seems like this problem may actually be exportGeosToWkb -- functions like wkbType() fail in the same way. It's possible that the mGeometry check at the beginning of these functions needs to move before teh exportGeosToWkb(), or that the exportGeosToWkb() needs to more resilient against being deleted.
Q: this issue has relations to other issues (IN FUTURE), so these can be handled when those are added? As example: http://hub.qgis.org/issues/10755