mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 05:41:42 +08:00
Virtual call screwup fix
This commit is contained in:
@@ -121,6 +121,9 @@ class UAVCAN_EXPORT DynamicTransferBufferManagerEntry
|
|||||||
uint16_t max_write_pos_;
|
uint16_t max_write_pos_;
|
||||||
const uint16_t max_size_;
|
const uint16_t max_size_;
|
||||||
|
|
||||||
|
/// Reset functionality must be implemented in a non-virtual method to call it safely from the destructor.
|
||||||
|
void doReset();
|
||||||
|
|
||||||
void resetImpl();
|
void resetImpl();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -136,7 +139,7 @@ public:
|
|||||||
|
|
||||||
~DynamicTransferBufferManagerEntry()
|
~DynamicTransferBufferManagerEntry()
|
||||||
{
|
{
|
||||||
DynamicTransferBufferManagerEntry::resetImpl();
|
doReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
static DynamicTransferBufferManagerEntry* instantiate(IPoolAllocator& allocator, uint16_t max_size);
|
static DynamicTransferBufferManagerEntry* instantiate(IPoolAllocator& allocator, uint16_t max_size);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ void DynamicTransferBufferManagerEntry::destroy(DynamicTransferBufferManagerEntr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicTransferBufferManagerEntry::resetImpl()
|
void DynamicTransferBufferManagerEntry::doReset()
|
||||||
{
|
{
|
||||||
max_write_pos_ = 0;
|
max_write_pos_ = 0;
|
||||||
Block* p = blocks_.get();
|
Block* p = blocks_.get();
|
||||||
@@ -109,6 +109,11 @@ void DynamicTransferBufferManagerEntry::resetImpl()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DynamicTransferBufferManagerEntry::resetImpl()
|
||||||
|
{
|
||||||
|
doReset();
|
||||||
|
}
|
||||||
|
|
||||||
int DynamicTransferBufferManagerEntry::read(unsigned offset, uint8_t* data, unsigned len) const
|
int DynamicTransferBufferManagerEntry::read(unsigned offset, uint8_t* data, unsigned len) const
|
||||||
{
|
{
|
||||||
if (!data)
|
if (!data)
|
||||||
|
|||||||
Reference in New Issue
Block a user