[Qgis-developer] QGIS crash on Mac OS X -- 0.8 release branch
Tom Elwertowski
telwertowski at comcast.net
Thu May 10 13:14:15 EDT 2007
Gary Sherman wrote:
> This problem turns out to happen here in providers/ogr/qgsogrprovider.cpp
> :
> void QgsOgrProvider::loadFields()
> {
> //the attribute fields need to be read again when the encoding changes
> attributeFields.clear();
> ...
> }
>
> When attributeFields.clear() is called, the crash occurs. If I comment
> it out, the layer will load fine, with the untidy side effect of having
> two sets of every field in the attribute table.
>
> The attributeFields member is a std::vector. I thought maybe something
> was amiss in my setup, so I wrote a small test program to create a
> vector, populate it, and clear it. It works fine.
>
> Any mac experts have any ideas as to why this is happening? I'm using
> the frameworks from kyngchaos.com.
Can you provide an example file or tell me what encoding to use? It
looks like the problem might be caused by specific encodings or even
specific files.
QgsOgrProvider::loadFields() is the only place attributeFields.clear()
is called. I tried calling loadFields() twice so a simple clear() isn't
the problem. I can also load a Swedish file which causes loadFields() to
be called a second time with a different encoding. It's the only
non-Mac-default encoding example I have.
My hypothesis is that loading fields first using the wrong encoding may
be bad for some but not all encodings. If this is the case, we should
always set the encoding first. At present, the encoding is known when
the QgsOgrProvider constructor is called but the constructor calls
loadFields() before the calling code calls setEncoding().
Tom
More information about the Qgis-developer
mailing list