I'm sorry..<div>Thank you Duncan for your support.<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Duncan Grisby</b> <span dir="ltr"><<a href="mailto:duncan@grisby.org">duncan@grisby.org</a>></span><br>
Date: 2011/10/17<br>Subject: Re: Possible bug in "T_var& operator= (T_ptr p)" operators<br>To: Tatiana Lazareva <<a href="mailto:tatiana.alexandrovna.lazareva@gmail.com">tatiana.alexandrovna.lazareva@gmail.com</a>><br>
Cc: <a href="mailto:info@omniorb-support.com">info@omniorb-support.com</a><br><br><br>Tatiana,<br>
<br>
Did you intend to post this to the omniORB mailing list? This email<br>
address is for queries about commercial support for omniORB. The address<br>
for the mailing list is <a href="mailto:omniorb-list@omniorb-support.com">omniorb-list@omniorb-support.com</a>.<br>
<br>
Regardless, there is not a bug in the T_var operator=. It is behaving as<br>
required by the spec. See section 4.5.1 of the C++ mapping<br>
specification:<br>
<br>
For example, the assignment statement in the code below will<br>
result in the object reference held by p to be released at the<br>
end of the block containing the declaration of a.<br>
<br>
// C++<br>
A_var a;<br>
A_ptr p = // ...somehow obtain an objref...<br>
a = p;<br>
<br>
<br>
Duncan.<br>
<br>
<br>
On Mon, 2011-10-17 at 09:55 +0400, Tatiana Lazareva wrote:<br>
> Hi all,<br>
><br>
> I have an error occurred in releaseObjRef function in omniInternal.cc<br>
> file in string: " int rc = --objref->pd_refCount;":<br>
> "ERROR -- trying to release an object with reference count <= 0.\n"<br>
> " CORBA::release() may have been called too many times on an<br>
> object\n"<br>
> " reference."<br>
><br>
><br>
> I investigate this problem and detected the following problem:<br>
> When I use this operator (templatedecls.h file, for template <class T,<br>
> class T_Helper> class _CORBA_ObjRef_Var class):<br>
> inline T_var& operator= (T_ptr p) {<br>
> T_Helper::release(pd_objref);<br>
> pd_objref = p;<br>
> return *this;<br>
> }<br>
> release function decrement refCount, but pd_objref is not removed, it<br>
> is only redefined.<br>
> So when I invoke any other function for this object (pd_objref - it is<br>
> not null, this is existence object with correct data), that internally<br>
> invoke releaseObjRef(), the pd_refCount for my object is 0 and I have<br>
> the error above.<br>
><br>
><br>
> I think that the "operator =" implemented with the bug and I fixed it<br>
> like this:<br>
> inline T_var& operator= (T_ptr p) {<br>
> T_Helper::duplicate(p);<br>
> T_Helper::release(pd_objref);<br>
> pd_objref = p;<br>
> return *this;<br>
> }<br>
><br>
><br>
> duplicate function increment refCount back. After this fix my error<br>
> disappears.<br>
><br>
><br>
> I noted that CORBA implementation contains many similar operators that<br>
> decrement refCount in release function, doesn't remove pd_objref, and<br>
> doesn't return refCount to correct value.<br>
><br>
><br>
> Could you please check this issue?<br>
><br>
><br>
> --<br>
><br>
><br>
> Cheers,<br>
><br>
> Tatiana Lazareva<br>
><br>
> e-mail (regular): <a href="mailto:Tatiana.Alexandrovna.Lazareva@gmail.com">Tatiana.Alexandrovna.Lazareva@gmail.com</a><br>
><br>
><br>
<font color="#888888"><br>
--<br>
-- Duncan Grisby --<br>
-- <a href="mailto:duncan@grisby.org">duncan@grisby.org</a> --<br>
-- <a href="http://www.grisby.org" target="_blank">http://www.grisby.org</a> --<br>
<br>
<br>
</font></div><br><br clear="all"><div><br></div>-- <br><p><font face="'Book Antiqua', serif"></font></p><p><font face="'Book Antiqua', serif"><span lang="EN-US" style="font-family:"Book Antiqua","serif""><span></span>Cheers,</span></font></p>
<font face="'Book Antiqua', serif">
<p><b><span lang="EN-US" style="font-family:"Book Antiqua","serif";color:red">T</span></b><span lang="EN-US" style="font-family:"Book Antiqua","serif"">atiana <b><span style="color:red">L</span></b>azareva</span><b><span style="font-family:"Book Antiqua","serif""></span></b></p>
</font><p></p><p><font face="'Book Antiqua', serif" color="#333333">e-mail (regular):</font><font face="'Book Antiqua', serif" color="#333333"> </font><font face="'Book Antiqua', serif" color="#FF6666"><u><a href="mailto:Tatiana.Alexandrovna.Lazareva@gmail.com" target="_blank">Tatiana.Alexandrovna.Lazareva@gmail.com</a></u></font></p>
<p><font face="'Book Antiqua', serif"><font color="#333333">e-mail (office): </font><u><font color="#FF6666"><a href="mailto:yumanova@mera.ru" target="_blank">yumanova@mera.ru</a></font></u></font></p><br>
</div>