[omniORB] [OMNIORB] Bug with lifecycle + multilevel inheritance?
Duncan Grisby
dpg1001@cam.ac.uk
Wed, 08 Jul 1998 14:29:56 +0100
On Wednesday 8 July, b.keeping@ic.ac.uk wrote:
> I believe I've found a bug in combining lifecycle support with
> multilevel inheritance. I am working with 2.5.0 on Solaris.
You have indeed found a bug. Below is a patch for o2be_interface.cc,
part of omniidl2, which fixes it.
Just out of interest, are you actually using the LifeCycle support, or
are you just experimenting?
OK, here's the patch to o2be_interface.cc:
1195c1195
< IND(s); s << uqname() << "_var _actual_" << _fqname() << ";\n\n";
---
> IND(s); s << objref_uqname() << " _actual_" << _fqname() << ";\n\n";
1245c1245
< IND(s); s << "void _set_proxy(" << lcproxy_uqname()
---
> IND(s); s << wrapproxy_uqname() << "(" << lcproxy_uqname()
1247d1246
< IND(s); s << wrapproxy_uqname() << "() {}\n";
1860d1858
< IND(s); s << "CORBA::release(p);\n";
2146c2144
< IND(s); s << "CORBA::release(_actual_" << _fqname() << ");\n";
---
> IND(s); s << "CORBA::release(_actual_" << _fqname() << ");";
2237c2235,2260
< << ",r,key,keysize,profiles,release)\n";
---
> << ",r,key,keysize,profiles,release)";
> {
> int ni,j;
> AST_Interface **intftable;
> ni = n_inherits();
> intftable = inherits();
> for (j=0; j< ni; j++)
> {
> o2be_interface * intf = o2be_interface::narrow_from_decl(intftable[j]);
> char* intf_name = (char*)intf->unambiguous_wrapproxy_name(this);
> if (o2be_global::mflag()) {
> // MSVC {4.2,5.0} cannot deal with a call to a virtual member
> // of a base class using the member function's fully/partially
> // scoped name. Have to use the alias for the base class in the
> // global scope to refer to the virtual member function instead.
> if (strcmp(intf_name,intf->wrapproxy_uqname()) != 0) {
> intf_name = new char[strlen(intf->_scopename())+
> strlen(intf->wrapproxy_uqname())+1];
> strcpy(intf_name,intf->_scopename());
> strcat(intf_name,intf->wrapproxy_uqname());
> }
> }
> s << ", " << intf_name << "(proxy)";
> }
> }
> s << "\n";
2242c2265,2304
< IND(s); s << "_set_proxy(proxy);\n";
---
> IND(s); s << "_orig_" << _fqname() << " = proxy;\n";
> IND(s); s << "_actual_" << _fqname() << " = " << fqname()
> << "::_duplicate(proxy);\n";
> DEC_INDENT_LEVEL();
> IND(s); s << "}\n\n";
>
> IND(s); s << wrapproxy_fqname() << "::" << wrapproxy_uqname()
> << "(" << lcproxy_fqname() << " *proxy)";
> {
> int ni,j;
> AST_Interface **intftable;
> ni = n_inherits();
> intftable = inherits();
> char *sep = " : ";
> for (j=0; j< ni; j++)
> {
> o2be_interface * intf = o2be_interface::narrow_from_decl(intftable[j]);
> char* intf_name = (char*)intf->unambiguous_wrapproxy_name(this);
> if (o2be_global::mflag()) {
> // MSVC {4.2,5.0} cannot deal with a call to a virtual member
> // of a base class using the member function's fully/partially
> // scoped name. Have to use the alias for the base class in the
> // global scope to refer to the virtual member function instead.
> if (strcmp(intf_name,intf->wrapproxy_uqname()) != 0) {
> intf_name = new char[strlen(intf->_scopename())+
> strlen(intf->wrapproxy_uqname())+1];
> strcpy(intf_name,intf->_scopename());
> strcat(intf_name,intf->wrapproxy_uqname());
> }
> }
> s << sep << intf_name << "(proxy)";
> sep = ", ";
> }
> }
> s << "\n";
> IND(s); s << "{\n";
> INC_INDENT_LEVEL();
> IND(s); s << "_orig_" << _fqname() << " = proxy;\n";
> IND(s); s << "_actual_" << _fqname() << " = " << fqname()
> << "::_duplicate(proxy);\n";
2253a2316,2317
> IND(s); s << "CORBA::release(_orig_" << _fqname() << ");\n";
> IND(s); s << "CORBA::release(_actual_" << _fqname() << ");\n";
2286a2351
> IND(s); s << "CORBA::release(_actual_" << _fqname() << ");\n";
2338a2404
> IND(s); s << "CORBA::release(_actual_" << _fqname() << ");\n";
2367,2403d2432
<
< // _set_proxy:
< IND(s); s << "void\n";
< IND(s); s << wrapproxy_fqname() << "::_set_proxy("
< << lcproxy_fqname() << " *proxy)\n";
< IND(s); s << "{\n";
< INC_INDENT_LEVEL();
< IND(s); s << "_orig_" << _fqname() << " = proxy;\n";
< IND(s); s << "_actual_" << _fqname() << " = " << fqname()
< << "::_duplicate(proxy);\n";
< {
< int ni,j;
< AST_Interface **intftable;
< ni = n_inherits();
< intftable = inherits();
< for (j=0; j< ni; j++)
< {
< o2be_interface * intf = o2be_interface::narrow_from_decl(intftable[j]);
< char* intf_name = (char*)intf->unambiguous_wrapproxy_name(this);
< if (o2be_global::mflag()) {
< // MSVC {4.2,5.0} cannot deal with a call to a virtual member
< // of a base class using the member function's fully/partially
< // scoped name. Have to use the alias for the base class in the
< // global scope to refer to the virtual member function instead.
< if (strcmp(intf_name,intf->wrapproxy_uqname()) != 0) {
< intf_name = new char[strlen(intf->_scopename())+
< strlen(intf->wrapproxy_uqname())+1];
< strcpy(intf_name,intf->_scopename());
< strcat(intf_name,intf->wrapproxy_uqname());
< }
< }
< IND(s); s << intf_name << "::_set_proxy(proxy);\n";
< }
< }
< DEC_INDENT_LEVEL();
< IND(s); s << "}\n";
<
Cheers,
Duncan.
--
-- Duncan Grisby --
-- dpg1001@cam.ac.uk, DGrisby@orl.co.uk --
-- http://www.cl.cam.ac.uk/~dpg1001/ --