Mon 12 Nov 2012 02:04:52 PM UTC, original submission:
I have fiexed this bug. please check that!
file: ObjectClassSet.cc
function: killFederate
original:
void ObjectClassSet::killFederate(FederateHandle theFederate)
throw ()
{
ObjectClassBroadcastList *ocbList = NULL ;
ObjectClassHandle currentClass = 0 ;
handled_iterator i;
for (i = fromHandle.begin(); i != fromHandle.end(); ++i) {
// Call KillFederate on that class until it returns NULL.
do {
D.Out(pdExcept, "Kill Federate Handle %d .", theFederate);
ocbList = i->second->killFederate(theFederate);
D.Out(pdExcept, "Federate Handle %d Killed.", theFederate);
// Broadcast RemoveObject message recursively
if (ocbList != 0) {
currentClass = i->second->getSuperclass();
D.Out(pdExcept, "List not NULL");
while (currentClass != 0) {
D.Out(pdRegister,
"Broadcasting Remove msg to parent class %d(Killed).",
currentClass);
// It may throw ObjectClassNotDefined
i->second = getObjectFromHandle(currentClass);
i->second->broadcastClassMessage(ocbList);
currentClass = i->second->getSuperclass();
}
delete ocbList ;
}
} while (ocbList != NULL);
}
D.Out(pdExcept, "End of the KillFederate Procedure.");
} /* end of killFederate */
fixed:
void ObjectClassSet::killFederate(FederateHandle theFederate)
throw ()
{
/ShiJian:Begin/
ObjectClassBroadcastList *ocbList = NULL ;
ObjectClassHandle currentClassHandle = 0 ;
bool judge=false;//Added
ObjectClass* currentClass = NULL ;//Added
handled_iterator i;
for (i = fromHandle.begin(); i != fromHandle.end(); ++i) {
// Call KillFederate on that class until it returns NULL.
do {
D.Out(pdExcept, "Kill Federate Handle %d .", theFederate);
currentClass=i->second;
ocbList = currentClass->killFederate(theFederate);
judge=false;
D.Out(pdExcept, "Federate Handle %d Killed.", theFederate);
// Broadcast RemoveObject message recursively
if (ocbList != NULL) {
currentClassHandle = currentClass->getSuperclass();
D.Out(pdExcept, "List not NULL");
while (currentClassHandle != 0) {
D.Out(pdRegister,
"Broadcasting Remove msg to parent class %d(Killed).",
currentClassHandle);
// It may throw ObjectClassNotDefined
currentClass = getWithHandle(currentClassHandle);
currentClass->broadcastClassMessage(ocbList);
currentClassHandle = currentClass->getSuperclass();
}
judge=true;
delete ocbList ;
ocbList=NULL;
}
} while (judge);
}
D.Out(pdExcept, "End of the KillFederate Procedure.");
/ShiJian:Begin/
}
|