--- a/RELEASE_NOTES Tue Apr 29 20:35:34 2014 +0200
+++ b/RELEASE_NOTES Tue Apr 29 22:38:13 2014 +0200
@@ -46,6 +46,7 @@
- Bug 1276 - optimize NistErrorRateModel
- Bug 1294 - New PeekU8 () and Read (Buffer::Iterator start, uint32_t size) methods in Buffer::Iterator
- Bug 1653 - Extension of CommandLine interface: restored operator << (CommandLine)
+- Bug 1717 - Detect unsettable attributes
- Bug 1739 - The endpoint is not deallocated for UDP sockets
- Bug 1786 - os << int64x64_t prints un-normalized fractional values
- Bug 1787 - Runtime error when using AnimationInterface::EnablePacketMetadata() to fetch metadata of CSMA packet
--- a/src/core/model/object-base.cc Tue Apr 29 20:35:34 2014 +0200
+++ b/src/core/model/object-base.cc Tue Apr 29 22:38:13 2014 +0200
@@ -75,13 +75,29 @@
struct TypeId::AttributeInformation info = tid.GetAttribute(i);
NS_LOG_DEBUG ("try to construct \""<< tid.GetName ()<<"::"<<
info.name <<"\"");
+ // is this attribute stored in this AttributeConstructionList instance ?
+ Ptr<AttributeValue> value = attributes.Find(info.checker);
+ // See if this attribute should not be set here in the
+ // constructor.
if (!(info.flags & TypeId::ATTR_CONSTRUCT))
{
- continue;
+ // Handle this attribute if it should not be
+ // set here.
+ if (value == 0)
+ {
+ // Skip this attribute if it's not in the
+ // AttributeConstructionList.
+ continue;
+ }
+ else
+ {
+ // This is an error because this attribute is not
+ // settable in its constructor but is present in
+ // the AttributeConstructionList.
+ NS_FATAL_ERROR ("Attribute name="<<info.name<<" tid="<<tid.GetName () << ": initial value cannot be set using attributes");
+ }
}
bool found = false;
- // is this attribute stored in this AttributeConstructionList instance ?
- Ptr<AttributeValue> value = attributes.Find(info.checker);
if (value != 0)
{
// We have a matching attribute value.