[Qgis-developer] VectorFileWriter

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Nov 27 17:34:12 EST 2007


Martin Dobias wrote:
> On Nov 27, 2007 5:42 PM, kimaidou <michael.douchin at laposte.net> wrote:
> 
>>Each time I try to load a vector layer with
>>that, Qgis crashes and quit with no prompt.
>>I tried to change some parameters, but I feel like a blind man trying to
>>catch a fly.
> 
> 
> Hi,
> 
> please could you paste the whole code here or point me to a link with the code?
> Because in any case QGIS shouldn't crash so we should fix it.
> 

  I think the problem is that the python variables I used for the 
QgsSymbols go out of scope, and so the underlying C++ objects get 
garbage-collected and deleted, hence when Qgis tries to render the 
layer, it crashes.

  The solution would be to tie the symbols to the renderer - I did:

  r = QgsContinuousColorRenderer(....)
  r.smin = QgsSymbol(...)
  r.smax = QgsSymbol(...)
  r.setMinimumSymbol(r.smin)

  and so on. Hence the symbols survive until the renderer is deleted.

Barry



More information about the Qgis-developer mailing list