minor behavioral change:




I just committed this;

	It fixes an uber-nasty I've been chasing for a while, it may alter
previous behavior (potentially), since we used to 'accumulate'
exceptions in the Environment in several cases - however that is a
broken approach garenteed to cause bugs/leaks.

	Just a head's up,

	Regards,

		Michael.

-- 
 michael@ximian.com  <><, Pseudo Engineer, itinerant idiot
? test/everything/core.18073
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/ORBit2/ChangeLog,v
retrieving revision 1.615
diff -u -p -u -r1.615 ChangeLog
--- ChangeLog	14 Jan 2004 11:03:52 -0000	1.615
+++ ChangeLog	14 Jan 2004 15:50:35 -0000
@@ -1,3 +1,15 @@
+2004-01-14  Michael Meeks  <michael@ximian.com>
+
+	* test/everything/client.c (testWithException): add.
+
+	* src/orb/orb-core/orbit-small.c
+	(ORBit_small_invoke_stub): always clean Environment
+	as it enters - otherwise there's no way of telling if
+	the return value is valid.
+
+	* src/orb/poa/poa.c (ORBit_c_stub_invoke): init ev.
+	here too; same reason; upd. locking comments.
+
 2004-01-14  The Written Word  <bugzilla-gnome@thewrittenword.com>
 
 	* include/orbit/GIOP/giop-recv-buffer.h: guint for
Index: src/orb/orb-core/corba-env.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/orb-core/corba-env.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 corba-env.c
--- src/orb/orb-core/corba-env.c	30 May 2003 15:55:09 -0000	1.20
+++ src/orb/orb-core/corba-env.c	14 Jan 2004 15:50:36 -0000
@@ -106,7 +106,7 @@ CORBA_exception_set (CORBA_Environment  
 		     void                *param)
 {
 	CORBA_exception_free(ev);
-  
+
 	ev->_major = major;
 	if (major != CORBA_NO_EXCEPTION) {
 		ev->_id = CORBA_string_dup (except_repos_id);
Index: src/orb/orb-core/orbit-small.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/orb-core/orbit-small.c,v
retrieving revision 1.94
diff -u -p -u -r1.94 orbit-small.c
--- src/orb/orb-core/orbit-small.c	9 Jan 2004 15:59:27 -0000	1.94
+++ src/orb/orb-core/orbit-small.c	14 Jan 2004 15:50:36 -0000
@@ -599,6 +599,8 @@ ORBit_small_invoke_stub (CORBA_Object   
 		goto clean_out;
 	}
 
+	CORBA_exception_init (ev);
+
 	if ((invoke_policy = ORBit_object_get_policy (obj)))
 		ORBit_policy_push (invoke_policy);
 
Index: src/orb/poa/orbit-adaptor.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/poa/orbit-adaptor.c,v
retrieving revision 1.24
diff -u -p -u -r1.24 orbit-adaptor.c
--- src/orb/poa/orbit-adaptor.c	2 Oct 2003 16:11:07 -0000	1.24
+++ src/orb/poa/orbit-adaptor.c	14 Jan 2004 15:50:36 -0000
@@ -248,7 +248,7 @@ ORBit_small_handle_request (ORBit_OAObje
 	 		    CORBA_Environment *ev)
 {
 	adaptor_obj->interface->handle_request (adaptor_obj, opname, ret, 
-					      args, ctx, recv_buffer, ev);
+						args, ctx, recv_buffer, ev);
 }
 
 gboolean
Index: src/orb/poa/poa.c
===================================================================
RCS file: /cvs/gnome/ORBit2/src/orb/poa/poa.c,v
retrieving revision 1.115
diff -u -p -u -r1.115 poa.c
--- src/orb/poa/poa.c	14 Jan 2004 11:04:13 -0000	1.115
+++ src/orb/poa/poa.c	14 Jan 2004 15:50:37 -0000
@@ -2590,21 +2590,27 @@ ORBit_c_stub_invoke (CORBA_Object       
 					 methods->_buffer[method_index].flags))) {
 		
 		/* Unwound PreCall
-		   ++( ((ORBit_POAObject)(obj)->adaptor_obj)->use_cnt );	    \
-		   (obj)->orb->current_invocations =                           \
-		   g_slist_prepend ((obj)->orb->current_invocations,   \
-		   (obj)->adaptor_obj);               \
+		   POA_LOCK (((ORBit_POAObject)(obj)->adaptor_obj)->poa);
+		   ++( ((ORBit_POAObject)(obj)->adaptor_obj)->use_cnt );
+		   POA_UNLOCK (((ORBit_POAObject)(obj)->adaptor_obj)->poa);
+		   (obj)->orb->current_invocations =
+		   g_slist_prepend ((obj)->orb->current_invocations,
+		   (obj)->adaptor_obj);
 		*/
-
+		
+		CORBA_exception_init (ev);
 		skel_impl (servant, ret, args, ctx, ev, method_impl);
 
 		/* Unwound PostCall
-		   (obj)->orb->current_invocations =                                                      \
-		   g_slist_remove ((obj)->orb->current_invocations, pobj);                        \
-		   --(((ORBit_POAObject)(obj)->adaptor_obj)->use_cnt);                                    \
-		   if (((ORBit_POAObject)(obj)->adaptor_obj)->life_flags & ORBit_LifeF_NeedPostInvoke)    \
-		   ORBit_POAObject_post_invoke (((ORBit_POAObject)(obj)->adaptor_obj));           \
+		   (obj)->orb->current_invocations =
+		   g_slist_remove ((obj)->orb->current_invocations, pobj);
+		   POA_LOCK (((ORBit_POAObject)(obj)->adaptor_obj)->poa);
+		   --(((ORBit_POAObject)(obj)->adaptor_obj)->use_cnt);
+		   if (((ORBit_POAObject)(obj)->adaptor_obj)->life_flags & ORBit_LifeF_NeedPostInvoke)
+			ORBit_POAObject_post_invoke (((ORBit_POAObject)(obj)->adaptor_obj));
+		   POA_UNLOCK (((ORBit_POAObject)(obj)->adaptor_obj)->poa);
 		*/
+
 	} else
 		ORBit_small_invoke_stub_n
 			(obj, methods, method_index,
Index: test/everything/client.c
===================================================================
RCS file: /cvs/gnome/ORBit2/test/everything/client.c,v
retrieving revision 1.119
diff -u -p -u -r1.119 client.c
--- test/everything/client.c	31 Oct 2003 12:12:57 -0000	1.119
+++ test/everything/client.c	14 Jan 2004 15:50:38 -0000
@@ -2116,6 +2116,32 @@ testNonExistent (test_TestFactory factor
 }
 
 static void
+testWithException (test_TestFactory factory, CORBA_Environment *ev)
+{
+	int old_flags;
+	CORBA_Object objref;
+
+	CORBA_exception_set (ev, CORBA_SYSTEM_EXCEPTION,
+			     ex_CORBA_OBJECT_NOT_EXIST, NULL);
+	objref = test_TestFactory_getBasicServer (factory, ev);
+	g_assert (ev->_major == CORBA_NO_EXCEPTION);
+	CORBA_Object_release (objref, ev);
+	g_assert (ev->_major == CORBA_NO_EXCEPTION);
+
+	old_flags = ORBit_small_flags;
+	ORBit_small_flags |= ORBIT_SMALL_FORCE_GENERIC_MARSHAL;
+
+	CORBA_exception_set (ev, CORBA_SYSTEM_EXCEPTION,
+			     ex_CORBA_OBJECT_NOT_EXIST, NULL);
+	objref = test_TestFactory_getBasicServer (factory, ev);
+	g_assert (ev->_major == CORBA_NO_EXCEPTION);
+	CORBA_Object_release (objref, ev);
+	g_assert (ev->_major == CORBA_NO_EXCEPTION);
+
+	ORBit_small_flags = old_flags;
+}
+
+static void
 run_tests (test_TestFactory   factory, 
 	   gboolean           thread_tests,
 	   CORBA_Environment *ev)
@@ -2160,6 +2186,7 @@ run_tests (test_TestFactory   factory, 
 			testPolicy (factory, thread_tests, ev);
 		}
 		testMisc (factory, ev);
+		testWithException (factory, ev);
 		testLifeCycle (factory, ev);
 	}
 	


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]