OMNeT++/OMNEST Bug Tracker - OMNeT++
View Issue Details
0001013OMNeT++simulation kernelpublic2017-05-24 20:292017-05-24 20:29
paolinux 
 
lowminoralways
newopen 
x86_64Windows10
5.1 
 
0001013: The "controlInfo" field is not copied by the message copy constructor
I've noticed that the controlInfo pointer associated to a given message is not copied by the copy constructor, i.e., the resulting copy will have controlInfo set to nullptr.

I'm not sure if this actually a bug or is the intended behavior. However, this turns out to incur a non-expected behavior in the controlInfo are associated to an encapsulated packet. Consider the following example;

auto encapsulatedMsg = new cMessage();
encapsulatedMsg.setControlInfo(...);

auto msg = new cMessage();
msg->encapsulate(encapsulatedMsg);

if now I call

msg->getEncapsulatedPacket();

this creates a copy of the object that does not have the controlInfo.

Wouldn't it make more sense to copy the controlInfo pointer to? (ie both the original message and the copy would point to the same memory location)

P.
No tags attached.
Issue History
2017-05-24 20:29paolinuxNew Issue

There are no notes attached to this issue.