-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Overview
Picture.get_paint() contains an error that causes an immediate access violation when called. All three ctypes lines inside the method incorrectly reference tvg_picture_get_size instead of tvg_picture_get_paint.
Reproducer
import thorvg_python as tvg
engine = tvg.Engine(threads=0)
pic = tvg.Picture(engine)
svg = (
b'<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">'
b'<circle id="ring" r="40" cx="50" cy="50" fill="red"/>'
b'</svg>'
)
pic.load_data(svg, 'svg', None, False)
pic.get_paint(12345) # OSError: exception: access violation writing 0x...
Root cause
In thorvg_python/paint/picture.py, the get_paint method:
def get_paint(self, _id: int):
self.thorvg_lib.tvg_picture_get_size.argtypes = [...] # ← wrong
self.thorvg_lib.tvg_picture_get_size.restype = ... # ← wrong
paint_struct = self.thorvg_lib.tvg_picture_get_size( # ← wrong
self._paint, ctypes.c_uint32(_id),
)Fix
Replace all three occurrences of tvg_picture_get_size with tvg_picture_get_paint.
Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels