[Qgis-developer] PyQGIS: Problems with the layerWasAdded SIGNAL

Germán Carrillo carrillo.german at gmail.com
Thu Jun 11 10:23:09 EDT 2009


I'm using PyQGIS. I have three classes in my app: Viewer, Legend and Load.
The Viewer class is the main one, the Load class add some data to canvas.
The Legend class has a SLOT to capture the layerWasAdded SIGNAL from the
QgsMapLayerRegistry class and when it happens add an item in a QTreeWidget.

The Legend class can remove layers. So, I have a problem with the SIGNAL
layerWasAdded. When I remove a layer I get multiple lines like this:

  Object::disconnect: Unexpected null parameter

After that, if I add the same layer again I get a segmentation fault that
crashes my app.

This happen even if I use a custom SIGNAL passing the layer object as
parameter from my Load class.

I'm working in Ubuntu 9.04 with latest versions of every package I need.

If I run my app in Windows XP I get the line ( Object::disconnect:
Unexpected null parameter ) multiple times, the app doesn't crashes but
every time it needs more time to load the layer.

I don't know what's the problem, because if I don't use the SIGNAL-SLOT
mechanism with that object (layer) my app works fine.
But I want to have components (and a real PyQt4 application), not a lot of
function calls across the classes.

Hope you can help me with this issue.

Thanks in advance.



Soluciones Geoinformáticas Libres
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20090611/8d33c5b2/attachment.html

More information about the Qgis-developer mailing list