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

This commit is contained in:
noirauds 2014-05-20 21:53:12 +02:00
parent 2bceacd707
commit a040f4de82

View File

@ -152,10 +152,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,
@ -171,7 +175,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: