[Qgis-developer] Segmentation fault while reading raster maps
JJL
buggerone at gmail.com
Wed Feb 11 10:59:27 EST 2009
Hello,
I have a segmentation fault with a python plugin when I do some
multiples reading of raster maps.
I can exhibit a small piece of code that can do it almost every times :
--8<------------------------------
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from qgis.core import *
from PyQt4.QtCore import *
if __name__ == "__main__":
# initialize qgis libraries
QgsApplication.initQgis()
for f in sys.argv[1:]:
print f,"..."
rlayer = QgsRasterLayer(QString(f), QFileInfo(f).baseName())
# clean qgis libraries
QgsApplication.exitQgis()
--8<------------------------------
You have to call it with redondant maps, for exemple :
python testRead.py 7124_2.kap 7124_4.kap 7124_2.kap 7124_4.kap
I have this behaviour with :
- some personal bsb raster files
- the NOAA bsb maps
- with qgis 1.0 on ubuntu gutsy
- with qgis 1.0 on windows (osgeo4w build)
I've compiled qgis 1.0 with debug symbols and here's the backtrace of
the segmentation fault with my plugin :
--8<------------------------------
#0 0x080e7672 in q_atomic_decrement (ptr=0x36) at
/usr/include/qt4/QtCore/qatomic_i386.h:97
#1 0x080e76c1 in QBasicAtomic::deref (this=0x36) at
/usr/include/qt4/QtCore/qatomic.h:93
#2 0xb73ff3ed in QMap<double, QColor>::operator= (this=0x89df808,
other=@0xbfb98d1c) at /usr/include/qt4/QtCore/qmap.h:388
#3 0xb73ff45a in QMap<double, QColor>::clear (this=0x89df808) at
/usr/include/qt4/QtCore/qmap.h:399
#4 0xb73fdb06 in QgsColorRampShader::setColorRampType
(this=0x89df7e0, theColorRampType=QgsColorRampShader::INTERPOLATED) at
/tmp/qgis_1.0.0/src/core/raster/qgscolorrampshader.cpp:204
#5 0xb741f027 in QgsRasterLayer::readFile (this=0x8b52100,
theFilename=@0x89ec818) at
/tmp/qgis_1.0.0/src/core/raster/qgsrasterlayer.cpp:5166
#6 0xb7427e3e in QgsRasterLayer (this=0x8b52100, path=@0x89ec818,
baseName=@0x85b87b8, loadDefaultStyleFlag=true) at
/tmp/qgis_1.0.0/src/core/raster/qgsrasterlayer.cpp:123
#7 0xb39d9ffb in sipQgsRasterLayer::sipQgsRasterLayer () from
/tmp/apps/share/qgis/python/qgis/core.so
#8 0xb39daffc in init_QgsRasterLayer () from
/tmp/apps/share/qgis/python/qgis/core.so
#9 0xb43114b1 in ?? () from /usr/lib/python2.5/site-packages/sip.so
#10 0x087d4cac in ?? ()
#11 0xb3807bac in ?? ()
#12 0xbfb990ec in ?? ()
#13 0xbfb990e8 in ?? ()
#14 0xb3807bac in ?? ()
#15 0x0872b11c in ?? ()
#16 0x00000002 in ?? ()
#17 0x0872b11c in ?? ()
--8<------------------------------
I had posted on the forums but unfortunately without results. See
http://forum.qgis.org/viewtopic.php?f=5&t=4480
Is it a bug of qgis or a misuse of QgsRasterLayer ?
Thanks
JJL
--
http://kubuntu.free.fr/wiki/?page=QGisRasterCatalog
More information about the Qgis-developer
mailing list