CORBA_Policy_destroy() fix
- From: Federico Mena Quintero <federico helixcode com>
- To: orbit-list cuc edu
- Cc: gnome-components-list gnome org
- Subject: CORBA_Policy_destroy() fix
- Date: Thu, 7 Dec 2000 19:59:45 -0600
Dearest dudes,
In BonoboPropertyBag we were creating three CORBA_Policy objects that
were never destroyed, so I added calls to CORBA_Policy_destroy().
However, this made the program recurse endlessly in precisely
CORBA_Policy_destroy(). The problem was that the release method
implementation in the policy's epv was declared to be that function
itself. So things got screwed up.
I just committed this patch per Elliot's recommendation. I *think* it
does the right thing, but an ORBit guru should check it anyways.
The code for the release function is mostly copied from
ORBit_POAManager_release(), which as far as I can tell should work in
the same way as the policy release function.
A thing that worries me is that the spec says CORBA_Policy_destroy()
can throw a NO_PERMISSION exception "when the policy object determines
that it cannot be destroyed". I have no idea what this means, so the
code never throws that exception. How should this be handled?
[For the Bonobo crowd: with my next commit to Bonobo you will require
the latest stable ORBit from CVS. Sorry.]
Federico
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/ORBit/ChangeLog,v
retrieving revision 1.11
diff -u -r1.11 ChangeLog
--- ChangeLog 1999/01/27 18:30:45 1.11
+++ ChangeLog 2000/12/08 01:45:07
@@ -1,2 +1,8 @@
+2000-12-07 Federico Mena Quintero <federico helixcode com>
+
+ * src/orb/orbit_object.c (ORBit_Policy_release): Proper release
+ function for CORBA_Policy objects.
+ (CORBA_Policy__epv): Point to the function above.
+
Do not touch this file. Run 'rcs2log' or use bonsai
(http://cvs.gnome.org/)
Index: src/orb/orbit_object.c
===================================================================
RCS file: /cvs/gnome/ORBit/src/orb/orbit_object.c,v
retrieving revision 1.55.4.1
diff -u -r1.55.4.1 orbit_object.c
--- src/orb/orbit_object.c 2000/09/27 18:38:26 1.55.4.1
+++ src/orb/orbit_object.c 2000/12/08 01:45:09
@@ -55,9 +55,12 @@
ORBIT_PSEUDO_OBJECT(obj)->pseudo_object_type = obj_type;
}
+static void ORBit_Policy_release(CORBA_Policy policy,
+ CORBA_Environment *ev);
+
static const ORBit_RootObject_Interface CORBA_Policy__epv =
{
- (void (*)(gpointer, CORBA_Environment *))CORBA_Policy_destroy
+ (void (*)(gpointer, CORBA_Environment *))ORBit_Policy_release
};
void ORBit_policy_object_init(CORBA_Policy obj,
@@ -72,6 +75,17 @@
ORBit_RootObject_set_interface(ORBIT_ROOT_OBJECT(obj),
(gpointer)&CORBA_Policy__epv,
ev);
+}
+
+/* Release method implementation for CORBA_Policy */
+static void
+ORBit_Policy_release(CORBA_Policy policy,
+ CORBA_Environment *ev)
+{
+ if(--(ORBIT_ROOT_OBJECT(policy)->refs) > 0)
+ return;
+
+ g_free(policy);
}
void ORBit_object_reference_init(CORBA_Object obj, CORBA_Environment *ev)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]