[omniORB] Fwd: Possible bug in "T_var& operator= (T_ptr p)" operators

Tatiana Lazareva tatiana.alexandrovna.lazareva at gmail.com
Thu Oct 20 15:27:45 BST 2011


I'm sorry..
Thank you Duncan for your support.

---------- Forwarded message ----------
From: Duncan Grisby <duncan at grisby.org>
Date: 2011/10/17
Subject: Re: Possible bug in "T_var& operator= (T_ptr p)" operators
To: Tatiana Lazareva <tatiana.alexandrovna.lazareva at gmail.com>
Cc: info at omniorb-support.com


Tatiana,

Did you intend to post this to the omniORB mailing list?  This email
address is for queries about commercial support for omniORB. The address
for the mailing list is omniorb-list at omniorb-support.com.

Regardless, there is not a bug in the T_var operator=. It is behaving as
required by the spec. See section 4.5.1 of the C++ mapping
specification:

       For example, the assignment statement in the code below will
       result in the object reference held by p to be released at the
       end of the block containing the declaration of a.

       // C++
       A_var a;
       A_ptr p = // ...somehow obtain an objref...
       a = p;


Duncan.


On Mon, 2011-10-17 at 09:55 +0400, Tatiana Lazareva wrote:
> Hi all,
>
> I have an error occurred in releaseObjRef function in omniInternal.cc
> file in string: "  int rc = --objref->pd_refCount;":
> "ERROR -- trying to release an object with reference count <= 0.\n"
>       " CORBA::release() may have been called too many times on an
> object\n"
>       " reference."
>
>
> I investigate this problem and detected the following problem:
> When I use this operator (templatedecls.h file, for template <class T,
> class T_Helper> class _CORBA_ObjRef_Var class):
>   inline T_var& operator= (T_ptr p) {
>     T_Helper::release(pd_objref);
>     pd_objref = p;
>     return *this;
>   }
> release function decrement refCount, but pd_objref is not removed, it
> is only redefined.
> So when I invoke any other function for this object (pd_objref - it is
> not null, this is existence object with correct data), that internally
> invoke releaseObjRef(), the pd_refCount for my object is 0 and I have
> the error above.
>
>
> I think that the "operator =" implemented with the bug and I fixed it
> like this:
>   inline T_var& operator= (T_ptr p) {
>     T_Helper::duplicate(p);
>     T_Helper::release(pd_objref);
>     pd_objref = p;
>     return *this;
>   }
>
>
> duplicate function increment refCount back. After this fix my error
> disappears.
>
>
> I noted that CORBA implementation contains many similar operators that
> decrement refCount in release function, doesn't remove pd_objref, and
> doesn't return refCount to correct value.
>
>
> Could you please check this issue?
>
>
> --
>
>
> Cheers,
>
> Tatiana Lazareva
>
> e-mail (regular): Tatiana.Alexandrovna.Lazareva at gmail.com
>
>

--
 -- Duncan Grisby         --
 -- duncan at grisby.org     --
  -- http://www.grisby.org --





-- 

Cheers,

*T*atiana *L*azareva**

e-mail (regular): *Tatiana.Alexandrovna.Lazareva at gmail.com*

e-mail (office): *yumanova at mera.ru*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20111020/434d08a5/attachment.htm


More information about the omniORB-list mailing list