[Qgis-developer] QGIS crash on Mac OS X -- 0.8 release branch

Gary Sherman sherman at mrcc.com
Thu May 10 21:31:06 EDT 2007

On May 10, 2007, at 9:14 AM, Tom Elwertowski wrote:

> 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.
By default my OGR open dialog was set to UTF8. Trying other encodings  
didn't make a difference.

Interestingly enough, Tim S. tried my binaries/libs on his box when  
this problem first popped up and he experienced the crash as well.  
I'm not certain how this relates to encoding. Is there a default  
somewhere for the system that is set wrong?

You can download a data set that I'm using from: http://gisalaska.com/ 
But I have this problem with every shapefile.

Thanks for your help!!


> 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
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.qgis.org
> http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer

Gary Sherman
Micro Resources: http://mrcc.com
   *Geospatial Hosting
   *Web Site Hosting
"We work virtually everywhere"

More information about the Qgis-developer mailing list