Fix crash when copy constructing unhandled packets
Actually this is a workaround: it does not attempt to copy construct unhandled packets, to avoid a bug in the base class where pointers were copy constructed without copying the contents. A proper fix will need refactoring of the packet storage code.
This commit is contained in:
@@ -33,6 +33,7 @@ LevelOnePage::LevelOnePage()
|
||||
clearPage();
|
||||
}
|
||||
|
||||
// BUG this copy constructor isn't used? Parameter should be LevelOnePage
|
||||
LevelOnePage::LevelOnePage(const PageBase &other)
|
||||
{
|
||||
m_enhancements.reserve(maxEnhancements());
|
||||
@@ -186,7 +187,9 @@ bool LevelOnePage::setPacket(int packetNumber, QByteArray packetContents)
|
||||
}
|
||||
|
||||
qDebug("LevelOnePage unhandled setPacket X/%d", packetNumber);
|
||||
return PageBase::setPacket(packetNumber, packetContents);
|
||||
// BUG can't store unhandled packets as default copy constructor uses pointers
|
||||
//return PageBase::setPacket(packetNumber, packetContents);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LevelOnePage::setPacket(int packetNumber, int designationCode, QByteArray packetContents)
|
||||
@@ -253,7 +256,9 @@ bool LevelOnePage::setPacket(int packetNumber, int designationCode, QByteArray p
|
||||
}
|
||||
|
||||
qDebug("LevelOnePage unhandled setPacket X/%d/%d", packetNumber, designationCode);
|
||||
return PageBase::setPacket(packetNumber, designationCode, packetContents);
|
||||
// BUG can't store unhandled packets as default copy constructor uses pointers
|
||||
//return PageBase::setPacket(packetNumber, designationCode, packetContents);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LevelOnePage::packetExists(int packetNumber) const
|
||||
|
||||
Reference in New Issue
Block a user