# Make sure the value will not deallocate as long as it is
# part of this object
ptr._pointer_values[offset] =value
# Handle native type
else:
# Go down to "instance level"
instance_ptr=ptr.get_pointer(offset)
# Is there no space allocated?
ifnotinstance_ptr:
# Allocate space for the value
instance_ptr=alloc(TYPE_SIZES[type_name.upper()])
# Add the pointer to the set, so there will be a reference
# until the instance gets deleted
ptr._allocated_pointers.add(instance_ptr)
# Set the pointer
ptr.set_pointer(instance_ptr, offset)
# Set the value
getattr(instance_ptr, 'set_'+type_name)(value)
And even if the Array inherits CustomType, the pointers set in the Array will be immediately discarded if not managed independently since the Array is dynamically created. (#490)
[SP] Caught an Exception:
Traceback (most recent call last):
File "../addons/source-python/packages/source-python/plugins/command.py", line 164, in load_plugin
plugin = self.manager.load(plugin_name)
File "../addons/source-python/packages/source-python/plugins/manager.py", line 209, in load
plugin._load()
File "../addons/source-python/packages/source-python/plugins/instance.py", line 74, in _load
self.module = import_module(self.import_name)
File "../addons/source-python/plugins/test/test.py", line 4703, in <module>
test_static_pointer_array()
File "../addons/source-python/plugins/test/test.py", line 4700, in test_static_pointer_array
test.static_vec_array[0] = Vector(0.1, 0.1, 0.1)
File "../addons/source-python/packages/source-python/memory/helpers.py", line 237, in __setitem__
self._make_attribute(index).__set__(self, value)
File "../addons/source-python/packages/source-python/memory/manager.py", line 505, in fset
ptr._pointer_values[offset] = value
AttributeError: 'Array' object has no attribute '_pointer_values'
Activity