[Qgis-developer] bug when calling QgsGeometry::setWkbAndOwnership from python (with patch)

Martin Dobias wonder.sk at gmail.com
Tue Jun 3 10:34:05 EDT 2008

On Tue, Jun 3, 2008 at 2:54 PM, Stefanie Tellex <stefie10 at media.mit.edu> wrote:
> Hi,
> The attached patch (against r8576) fixes a bug I ran into when trying to
> call  QgsGeometry::setWkbAndOnwership from python.    When calling it from
>  python, the caller cannot release ownership of the input buffer, and I
>  would get a seg fault.   I put a wrapper around the method that makes a
>  copy before passing it to the C code.
> There's no memory leak (I don't think), because python retains ownership
> of the input string, and the qgsgeometry object owns the copy.

Hi Stefanie,

thanks for the patch. You're right, the correct behaviour should push
to setWkbAndOwnership() only copy of Python string. I've just changed
allocation from "malloc" to "new" so that it matches the way used in
QGIS and applied as r8580.


More information about the Qgis-developer mailing list