Ticket #25072: 25072_segfault.diff

File 25072_segfault.diff, 1.3 KB (added by Daniel Wiesmann, 9 years ago)

This test leads to a segfault on my system.

  • django/contrib/gis/gdal/raster/band.py

    diff --git a/django/contrib/gis/gdal/raster/band.py b/django/contrib/gis/gdal/raster/band.py
    index f1eb50e..19f39e7 100644
    a b  
     1import weakref
    12from ctypes import byref, c_int
    23
    34from django.contrib.gis.gdal.base import GDALBase
    class GDALBand(GDALBase):  
    1415    Wraps a GDAL raster band, needs to be obtained from a GDALRaster object.
    1516    """
    1617    def __init__(self, source, index):
    17         self.source = source
     18        self.source = weakref.proxy(source)
    1819        self._ptr = capi.get_ds_raster_band(source._ptr, index)
    1920
    2021    @property
  • tests/gis_tests/rasterapp/test_rasterfield.py

    diff --git a/tests/gis_tests/rasterapp/test_rasterfield.py b/tests/gis_tests/rasterapp/test_rasterfield.py
    index d1c015f..50d58b4 100644
    a b class RasterFieldTest(TransactionTestCase):  
    2323        r.refresh_from_db()
    2424        self.assertIsNone(r.rast)
    2525
     26    def test_access_band_data_direclty_from_queryset(self):
     27        RasterModel.objects.create(rast=JSON_RASTER)
     28        qs = RasterModel.objects.all()
     29        qs[0].rast.bands[0].data()
     30
    2631    def test_model_creation(self):
    2732        """
    2833        Test RasterField through a test model.
Back to Top