Geography: Bug #007722 : segfault in cairo.SurfaceImage.create_from_png

This commit is contained in:
noirauds 2014-05-20 21:34:15 +02:00
parent 928e32d030
commit 56efd58004

View File

@ -153,10 +153,14 @@ class GeoGraphyView(OsmGps, NavigationView):
self.geo_mainmap = None
path = os.path.join(IMAGE_DIR, "48x48",
('gramps-geo-mainmap' + '.png' ))
self.geo_mainmap = cairo.ImageSurface.create_from_png(path)
with open(path, 'rb') as fh: # this is to avoid bug with cairo 1.8.8
self.geo_mainmap = cairo.ImageSurface.create_from_png(fh)
#self.geo_mainmap = cairo.ImageSurface.create_from_png(path)
path = os.path.join(IMAGE_DIR, "48x48",
('gramps-geo-altmap' + '.png' ))
self.geo_altmap = cairo.ImageSurface.create_from_png(path)
with open(path, 'rb') as fh: # this is to avoid bug with cairo 1.8.8
self.geo_altmap = cairo.ImageSurface.create_from_png(fh)
#self.geo_altmap = cairo.ImageSurface.create_from_png(path)
if ( config.get('geography.map_service') in
( constants.OPENSTREETMAP,
constants.MAPS_FOR_FREE,
@ -172,7 +176,9 @@ class GeoGraphyView(OsmGps, NavigationView):
EventType.MARRIAGE ):
path = os.path.join(IMAGE_DIR, "48x48",
(constants.ICONS.get(int(ident), default_image) + '.png' ))
self.geo_othermap[ident] = cairo.ImageSurface.create_from_png(path)
with open(path, 'rb') as fh: # this is to avoid bug with cairo 1.8.8
self.geo_othermap[ident] = cairo.ImageSurface.create_from_png(fh)
#self.geo_othermap[ident] = cairo.ImageSurface.create_from_png(path)
def add_bookmark(self, menu, handle):
if handle: