Hi On Fri, Aug 24, 2012 at 9:32 AM, Matthias Kuhn <[email protected]> wrote: > Just figured out that the sip option /Factory/ tells python that it > takes ownership of this object. So there won't be any memory loss. I'd > still say this should be changed and if not at least stated in the API > so anybody using this in C++ will be aware of this without reading the > code. >
Patches to the code that document things better will be welome. Regards Tim > On Thu, 2012-08-23 at 12:47 +0000, Kuhn Matthias, Vermessung wrote: >> Hi >> >> I've recently been working with the network analysis library. >> >> When I had a look at the code I noticed the following: >> >> In the constructor a new QgsGraph() mGraph is instantiated >> In the destructor mGraph is deleted if not null >> In the method graph() mGraph is returned and set to null >> >> This leads to the effect, that if I request the graph() from the >> QgsGraphBuilder ( and I normally will, as that's the only purpose of using >> the QgsGraphBuilder ) I get the full ownership and have to delete the >> graph-object, when I'm finished with it. But this is not stated in the API. >> So without looking at the code there is no way to know this. >> >> - How does python handle this? Does the following code delete this object? >> >> graph = graphBuilder.graph() >> graph = null >> >> - In my opinion, this is a wrong design. I would rather pass a graph-object >> to the graphbuilder in the constructor and let it fill this object. Then I >> know, that is my responsibility to delete it afterwards. >> >> I would provide a patch to change this if there are no good reasons to keep >> it the way it is. >> >> Regards, >> Matthias >> _______________________________________________ >> Qgis-developer mailing list >> [email protected] >> http://lists.osgeo.org/mailman/listinfo/qgis-developer > > > _______________________________________________ > Qgis-developer mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/qgis-developer -- Tim Sutton - QGIS Project Steering Committee Member (Release Manager) ============================================== Please do not email me off-list with technical support questions. Using the lists will gain more exposure for your issues and the knowledge surrounding your issue will be shared with all. Visit http://linfiniti.com to find out about: * QGIS programming and support services * Mapserver and PostGIS based hosting plans * FOSS Consulting Services Skype: timlinux Irc: timlinux on #qgis at freenode.net ============================================== _______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
