activation patch ....



Hi there,

	This fixes async activation,

	May I commit,

		Michael.

? mjs
? bonobo-activation-0.7.0.tar.gz
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo-activation/ChangeLog,v
retrieving revision 1.231
diff -u -r1.231 ChangeLog
--- ChangeLog	2001/10/12 10:01:59	1.231
+++ ChangeLog	2001/10/16 08:26:38
@@ -1,3 +1,23 @@
+2001-10-17  Michael Meeks  <michael ximian com>
+
+	* bonobo-activation/bonobo-activation-async-callback.c
+	(impl_Bonobo_ActivationCallback__destroy): don't free the
+	servant while we still need it.
+	(impl_Bonobo_ActivationCallback__finalize): do it here.
+
+	* test/bonobo-activation-test-async.c: rename type to
+	have _t suffix.
+
+	* bonobo-activation/bonobo-activation-async-callback.c
+	(impl_Bonobo_ActivationCallback_vepv): fix fatal
+	brokenness and lack of type safety. re-order & kill
+	redundant prototypes.
+	(impl_Bonobo_ActivationCallback__destroy): make static,
+	only used localy.
+	(impl_Bonobo_ActivationCallback_report_activation_failed),
+	(impl_Bonobo_ActivationCallback_report_activation_succeeded):
+	fix signatures to give more type safety.
+
 2001-10-12  Carlos Perelló Marín <carlos gnome-db org>

 	* server/activation-server-main.c: /s/oafinfo/server/
Index: bonobo-activation/bonobo-activation-async-callback.c
===================================================================
RCS file: /cvs/gnome/bonobo-activation/bonobo-activation/bonobo-activation-async-callback.c,v
retrieving revision 1.4
diff -u -r1.4 bonobo-activation-async-callback.c
--- bonobo-activation/bonobo-activation-async-callback.c	2001/07/31 16:52:01	1.4
+++ bonobo-activation/bonobo-activation-async-callback.c	2001/10/16 08:26:39
@@ -32,112 +32,48 @@
 #include <bonobo-activation/Bonobo_ActivationContext.h>

 /*** App-specific servant structures ***/
+
 typedef struct {

    POA_Bonobo_ActivationCallback servant;
-   PortableServer_POA poa;
-   BonoboActivationCallback callback;
-   gpointer user_data;
+   PortableServer_POA            poa;
+   BonoboActivationCallback      callback;
+   gpointer                      user_data;

 } impl_POA_Bonobo_ActivationCallback;

-void
-impl_Bonobo_ActivationCallback__destroy(impl_POA_Bonobo_ActivationCallback *servant,
-				     CORBA_Environment *ev);
-
-
-
-/*** Implementation stub prototypes ***/
-
-static void
-impl_Bonobo_ActivationCallback_report_activation_failed
-           (impl_POA_Bonobo_ActivationCallback * servant,
-	    CORBA_char * reason,
-	    CORBA_Environment * ev);
-
-static void
-impl_Bonobo_ActivationCallback_report_activation_succeeded
-           (impl_POA_Bonobo_ActivationCallback * servant,
-	    Bonobo_ActivationResult * result,
-	    CORBA_Environment * ev);
-
-/*** epv structures ***/

-static PortableServer_ServantBase__epv impl_Bonobo_ActivationCallback_base_epv = {
-   NULL,			/* _private data */
-   NULL,			/* finalize routine */
-   NULL,			/* default_POA routine */
-};
-static POA_Bonobo_ActivationCallback__epv impl_Bonobo_ActivationCallback_epv = {
-   NULL,			/* _private */
-   (gpointer) &impl_Bonobo_ActivationCallback_report_activation_failed,
-
-   (gpointer) &impl_Bonobo_ActivationCallback_report_activation_succeeded,
-
-};
-
-/*** vepv structures ***/
-
-static POA_Bonobo_ActivationCallback__vepv impl_Bonobo_ActivationCallback_vepv = {
-        (gpointer) &impl_Bonobo_ActivationCallback_base_epv,
-        (gpointer) &impl_Bonobo_ActivationCallback_epv,
-};
-
 /*** Stub implementations ***/

-CORBA_Object
-bonobo_activation_async_corba_callback_new (BonoboActivationCallback callback,
-                                            gpointer user_data,
-                                            CORBA_Environment * ev)
+static void
+impl_Bonobo_ActivationCallback__finalize (
+        PortableServer_Servant servant,
+        CORBA_Environment *ev)
 {
-   CORBA_Object retval;
-   impl_POA_Bonobo_ActivationCallback *newservant;
-   PortableServer_ObjectId *objid;
-   PortableServer_POA poa;
-   PortableServer_POAManager manager;
-   CORBA_ORB orb;
-
-   orb = bonobo_activation_orb_get ();
-
-   poa =  (PortableServer_POA) CORBA_ORB_resolve_initial_references (orb, "RootPOA", ev);
-   manager = PortableServer_POA__get_the_POAManager (poa, ev);
-   PortableServer_POAManager_activate (manager, ev);
-
-   newservant = g_new0(impl_POA_Bonobo_ActivationCallback, 1);
-   newservant->servant.vepv = &impl_Bonobo_ActivationCallback_vepv;
-   newservant->poa = poa;
-   newservant->callback = callback;
-   newservant->user_data = user_data;
-
-   POA_Bonobo_ActivationCallback__init((PortableServer_Servant) newservant, ev);
-   objid = PortableServer_POA_activate_object(poa, newservant, ev);
-   CORBA_free(objid);
-   retval = PortableServer_POA_servant_to_reference(poa, newservant, ev);
-
-   return retval;
+        g_free (servant);
 }

-void
-impl_Bonobo_ActivationCallback__destroy(impl_POA_Bonobo_ActivationCallback *servant,
-				     CORBA_Environment * ev)
+static void
+impl_Bonobo_ActivationCallback__destroy (
+        impl_POA_Bonobo_ActivationCallback *servant,
+        CORBA_Environment *ev)
 {
-   PortableServer_ObjectId *objid;
-
-   objid = PortableServer_POA_servant_to_id(servant->poa, servant, ev);
-   PortableServer_POA_deactivate_object(servant->poa, objid, ev);
-   CORBA_free(objid);
+        PortableServer_ObjectId *objid;

-   POA_Bonobo_ActivationCallback__fini((PortableServer_Servant) servant, ev);
-   g_free(servant);
+        objid = PortableServer_POA_servant_to_id (servant->poa, servant, ev);
+        PortableServer_POA_deactivate_object (servant->poa, objid, ev);
+        CORBA_free (objid);
 }

 static void
-impl_Bonobo_ActivationCallback_report_activation_failed
-   (impl_POA_Bonobo_ActivationCallback * servant,
-    CORBA_char * reason,
-    CORBA_Environment * ev)
+impl_Bonobo_ActivationCallback_report_activation_failed (
+        PortableServer_Servant _servant,
+        const CORBA_char * reason,
+        CORBA_Environment * ev)
 {
         char *message;
+        impl_POA_Bonobo_ActivationCallback * servant =
+                (impl_POA_Bonobo_ActivationCallback *) _servant;

         if (servant->callback == NULL) {
                 return;
@@ -146,18 +82,20 @@
         message = g_strconcat ("Activation failed: ", reason, NULL);
         servant->callback (CORBA_OBJECT_NIL, message, servant->user_data);
         g_free (message);
-
+
         /* destroy this object */
         impl_Bonobo_ActivationCallback__destroy (servant, ev);
 }

 static void
-impl_Bonobo_ActivationCallback_report_activation_succeeded
-   (impl_POA_Bonobo_ActivationCallback * servant,
-    Bonobo_ActivationResult * result,
-    CORBA_Environment * ev)
+impl_Bonobo_ActivationCallback_report_activation_succeeded (
+        PortableServer_Servant _servant,
+        const Bonobo_ActivationResult * result,
+        CORBA_Environment * ev)
 {
         CORBA_Object retval;
+        impl_POA_Bonobo_ActivationCallback * servant =
+                (impl_POA_Bonobo_ActivationCallback *) _servant;

         retval = CORBA_OBJECT_NIL;

@@ -167,7 +105,8 @@

 	switch (result->res._d) {
 	case Bonobo_ACTIVATION_RESULT_SHLIB:
-                retval = bonobo_activation_activate_shlib_server (result, ev);
+                retval = bonobo_activation_activate_shlib_server (
+                        (Bonobo_ActivationResult *) result, ev);
 		break;
 	case Bonobo_ACTIVATION_RESULT_OBJECT:
 		retval = CORBA_Object_duplicate (result->res._u.res_object, ev);
@@ -190,4 +129,66 @@

         /* destroy this object */
         impl_Bonobo_ActivationCallback__destroy (servant, ev);
+}
+
+/*** epv structures ***/
+
+static PortableServer_ServantBase__epv impl_Bonobo_ActivationCallback_base_epv = {
+        NULL, /* _private data */
+        impl_Bonobo_ActivationCallback__finalize,
+        NULL, /* default_POA routine */
+};
+static POA_Bonobo_ActivationCallback__epv impl_Bonobo_ActivationCallback_epv = {
+        NULL, /* _private */
+        &impl_Bonobo_ActivationCallback_report_activation_failed,
+        &impl_Bonobo_ActivationCallback_report_activation_succeeded,
+};
+
+/* FIXME: fill me in / deal with me globaly */
+static POA_Bonobo_Unknown__epv impl_Bonobo_Unk

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




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