[PyQt] [PyQtMobility] QGeoServiceProvider factory methods

David Boddie david at boddie.org.uk
Fri Mar 11 18:05:00 GMT 2011


I've been looking at using Qt Mobility 1.1 (or thereabouts) with PyQtMobility
0.2 and I encountered an issue with the QGeoServiceProvider.mappingManager()
factory method. It seems that the documented behaviour of the method
conflicts with the bindings for that class in which the method is annotated
with the /Factory/ annotation.

The documentation says this:

  This function will attempt to construct a QGeoMappingManager instance
  when it is called for the first time.  If the attempt is successful the
  QGeoMappingManager will be cached, otherwise each call of this function
  will attempt to construct a QGeoMappingManager instance until the
  construction is successful.

The result is that, if I call this method to obtain a QGeoMappingManager,
Python gets ownership of it. So, if I let it go out of scope, the underlying
object is destroyed, and calling the method again will result in a segfault.

I imagine the problem also exists for the routingManager() and
searchManager() methods.

David


More information about the PyQt mailing list