[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi RTIG/Federation.cc libCERTI/RootObject.cc
From: |
certi-cvs |
Subject: |
[certi-cvs] certi RTIG/Federation.cc libCERTI/RootObject.cc |
Date: |
Wed, 12 Aug 2009 13:48:37 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: Eric NOULARD <erk> 09/08/12 13:48:37
Modified files:
RTIG : Federation.cc
libCERTI : RootObject.cc
Log message:
Fix bug #27227 : registerObjectInstance fails(), an object is still
added to ObjectSet
Patch derived from proposed patch by Rod Leonard.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/RTIG/Federation.cc?cvsroot=certi&r1=3.107&r2=3.108
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/RootObject.cc?cvsroot=certi&r1=3.40&r2=3.41
Patches:
Index: RTIG/Federation.cc
===================================================================
RCS file: /sources/certi/certi/RTIG/Federation.cc,v
retrieving revision 3.107
retrieving revision 3.108
diff -u -b -r3.107 -r3.108
--- RTIG/Federation.cc 19 May 2009 09:52:06 -0000 3.107
+++ RTIG/Federation.cc 12 Aug 2009 13:48:36 -0000 3.108
@@ -18,7 +18,7 @@
// along with this program ; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// $Id: Federation.cc,v 3.107 2009/05/19 09:52:06 gotthardp Exp $
+// $Id: Federation.cc,v 3.108 2009/08/12 13:48:36 erk Exp $
// ----------------------------------------------------------------------------
#include <config.h>
@@ -1590,8 +1590,18 @@
strname += object_name ? string(object_name) : "HLA" + new_id ;
// Register Object.
+ try
+ {
root->registerObjectInstance(federate, class_handle, new_id,
strname.c_str());
+ }
+ catch(...)
+ { //If an exception was thrown, the object instance was not added
+ //and we can free the object handle id for future use and rethrow
+ //the exception
+ objectHandles.free(new_id);
+ throw;
+ }
G.Out(pdGendoc,"exit Federation::registerObject");
return new_id ;
}
@@ -2572,5 +2582,5 @@
}} // namespace certi/rtig
-// $Id: Federation.cc,v 3.107 2009/05/19 09:52:06 gotthardp Exp $
+// $Id: Federation.cc,v 3.108 2009/08/12 13:48:36 erk Exp $
Index: libCERTI/RootObject.cc
===================================================================
RCS file: /sources/certi/certi/libCERTI/RootObject.cc,v
retrieving revision 3.40
retrieving revision 3.41
diff -u -b -r3.40 -r3.41
--- libCERTI/RootObject.cc 8 Nov 2008 11:36:05 -0000 3.40
+++ libCERTI/RootObject.cc 12 Aug 2009 13:48:37 -0000 3.41
@@ -19,7 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
//
-// $Id: RootObject.cc,v 3.40 2008/11/08 11:36:05 erk Exp $
+// $Id: RootObject.cc,v 3.41 2009/08/12 13:48:37 erk Exp $
// ----------------------------------------------------------------------------
#include "Object.hh"
@@ -248,8 +248,17 @@
Object *object ;
object = objects->registerObjectInstance(the_federate, the_class,
the_object, the_object_name);
-
+ try {
ObjectClasses->registerObjectInstance(the_federate, object, the_class);
+ }
+ catch(...)
+ { //the object is added to the ObjectSet before we check to see if the
+ //object class has been defined or published. Therefore, if an
+ //exception is thrown and the instance was not added, we remove
+ //it from the ObjectSet here and rethrow the exception.
+ objects->deleteObjectInstance(the_federate, the_object, "");
+ throw;
+ }
}
// ----------------------------------------------------------------------------
@@ -351,4 +360,4 @@
} // namespace certi
-// $Id: RootObject.cc,v 3.40 2008/11/08 11:36:05 erk Exp $
+// $Id: RootObject.cc,v 3.41 2009/08/12 13:48:37 erk Exp $
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi RTIG/Federation.cc libCERTI/RootObject.cc,
certi-cvs <=