Commit e7486812 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix SWIG access to raw pointer with proxy classes

parent e8e29299
...@@ -178,7 +178,13 @@ class sdlHandler(QObject): ...@@ -178,7 +178,13 @@ class sdlHandler(QObject):
# get internal variables, translate them to swig, and print them # get internal variables, translate them to swig, and print them
setter_ptr = getattr(self.dll, "_set_{}".format(var)) setter_ptr = getattr(self.dll, "_set_{}".format(var))
value_asn1 = target_state[idx] value_asn1 = target_state[idx]
value_ptr = ctypes.cast(value_asn1._ptr.__long__(), try:
value_swig_ptr = int(value_asn1._ptr)
except TypeError:
# for some types, swig uses a proxy class, in which case the
# pointer is not in _ptr but in _ptr.this
value_swig_ptr = int(value_asn1._ptr.this)
value_ptr = ctypes.cast(value_swig_ptr,
ctypes.POINTER(ctypes.c_uint32)) ctypes.POINTER(ctypes.c_uint32))
setter_ptr(value_ptr) setter_ptr(value_ptr)
state_value = target_state[idx+1] state_value = target_state[idx+1]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment