From bd3c6468895113447abbe089bf8073821367ba9f Mon Sep 17 00:00:00 2001 From: Matthew Joyce Date: Tue, 4 Jul 2017 09:58:10 +0100 Subject: [PATCH] Fix segfaults caused when using TransformableDrawable --- src/sfml/graphics/graphics.pyx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sfml/graphics/graphics.pyx b/src/sfml/graphics/graphics.pyx index 8538dbb..28efc9c 100644 --- a/src/sfml/graphics/graphics.pyx +++ b/src/sfml/graphics/graphics.pyx @@ -1269,9 +1269,14 @@ cdef public class TransformableDrawable(Drawable)[type PyTransformableDrawableTy cdef sf.Transformable *p_transformable def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + if self.__class__ == TransformableDrawable: raise NotImplementedError('TransformableDrawable is not meant to be used') + if self.p_transformable is NULL: + self.p_transformable = new sf.Transformable() + def __repr__(self): return "TransformableDrawable(position={0}, rotation={1}, ratio={2}, origin={3})".format(self.position, self.rotation, self.ratio, self.origin)