[omniORB] _this() in constructor

Kevin Bailey keraba@yahoo.com
Mon, 5 Mar 2001 10:24:07 -0800


Just to double-check, bad things may happen if one calls _this()
inside a servant's constructor, because virtual pointers may
not be set up yet and some constructors may not have finished ?

I hadn't seen a problem doing this until I made some classes
with non-trivial inheritance, so I was hoping to make sure that
the problem wasn't something else.

Here's a typical hierarchy:

base_servant   RefCountServantBase
     |                  |
     +----subclass_1----+
             |
          subclass_2
             |
          subclass_3

When I call _this() in subclass 1, 2, or 3's constructor, I get
the following error:

omniORB: Application check failed. This indicates a bug in the application
 using omniORB.  See the comment in the source code for more info.
 file: ../portableserver.cc
 line: 320
 info: pd_refCount > 0

and sometimes a segmentation fault. It looks like _this() (well,
really the POA) is calling RefCountServantBase::add_ref before
the RefCountServantBase's constructor got called.