[QGIS-Developer] QgsRasterHistogram Python bindings

Alexander Bruy alexander.bruy at gmail.com
Wed Aug 2 06:00:28 PDT 2017


Here is backtrace produced by QGIS https://pastebin.com/HfnVhKDd.
And another one taked with gdb https://pastebin.com/q7a2wgg9.

Also tested on Windows using latest nightly build (c373c8b). No crash,
but error

Traceback (most recent call last):
  File "C:\OSGeo4W\apps\Python36\lib\code.py", line 91, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
MemoryError

For testing I use following code and dem.tif layer from Processing
test dataset:

layer = iface.mapCanvas().activeLayer()
histogram = layer.dataProvider().histogram(1, 10, None, None,
QgsRectangle(), 0, False)
histogram.histogramVector

2017-08-02 12:55 GMT+03:00 Denis Rouzaud <denis.rouzaud at gmail.com>:
> Hi,
>
> I'm not getting any crash here.
> Do you have any mean to produce a stacktrace?
>
> Denis
>
>
> Le mar. 1 août 2017 à 12:30, Alexander Bruy <alexander.bruy at gmail.com> a
> écrit :
>>
>> Just tried this and still got crash
>>
>> 2017-08-01 12:08 GMT+03:00 Nyall Dawson <nyall.dawson at gmail.com>:
>> > On 1 August 2017 at 17:40, Alexander Bruy <alexander.bruy at gmail.com>
>> > wrote:
>> >> Hi,
>> >>
>> >> while working on Processing algorithms I have found an issue with
>> >> QgsRasterHistogram class. According to the documentation, member
>> >> histogramVector should not be available in Python [0], but it is
>> >> present
>> >> in the corresponding SIP file. However, any attempt to access this
>> >> member
>> >> leads to QGIS crash.
>> >>
>> >> Should we remove histogramVector from Python? Or it should be exposed
>> >> and there is a bug/incomplete implementation in bindings?
>> >
>> > That's odd - there's nothing particularly unusal about
>> > HistogramVector. A vector of ints should be accessibly from Python.
>> >
>> > Why not try removing the typedef use from the sip file and see if that
>> > helps? E.g.
>> >
>> > #ifndef SIP_RUN
>> > HistogramVector histogramVector;
>> > #else
>> > QVector<int> histogramVector;
>> > #endif
>> >
>> > Nyall
>> >
>> >
>> >
>> >>
>> >> [0]
>> >> http://qgis.org/api/classQgsRasterHistogram.html#a9bd23abeb4764f3a6c73975ee96fd4ff
>> >>
>> >> --
>> >> Alexander Bruy
>> >> _______________________________________________
>> >> QGIS-Developer mailing list
>> >> QGIS-Developer at lists.osgeo.org
>> >> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> >> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>>
>> --
>> Alexander Bruy
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



-- 
Alexander Bruy


More information about the QGIS-Developer mailing list