CAN packer/parser: clean up after alloc (#1007)

* Update packer_pyx.pyx

* this new also needs to be cleaned up
This commit is contained in:
Shane Smiskol 2024-02-06 21:02:08 -06:00 committed by GitHub
parent 7397e466d9
commit 3d1be8427a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -26,6 +26,10 @@ cdef class CANPacker:
msg = self.dbc[0].msgs[i]
self.name_to_address[string(msg.name)] = msg.address
def __dealloc__(self):
if self.packer:
del self.packer
cdef vector[uint8_t] pack(self, addr, values):
cdef vector[SignalPackValue] values_thing
values_thing.reserve(len(values))

View File

@ -66,6 +66,10 @@ cdef class CANParser:
self.can = new cpp_CANParser(bus, dbc_name, message_v)
self.update_strings([])
def __dealloc__(self):
if self.can:
del self.can
def update_strings(self, strings, sendcan=False):
for v in self.vl_all.values():
for l in v.values(): # no-cython-lint