<div dir="ltr"><div>Hi!</div><div>Following is the psuedo code</div><div><br></div>//MainCORBAImpl.h<div>class CMainCORBAImpl</div><div>{</div><div>    public:</div><div>            XServicePtr GetXService();</div><div><br></div><div>   private:      </div><div>      XServicePtr m_XSvc;</div><div>      PortableServer::servant_var<Servant>   m_pServant;</div><div>};</div><div><br></div><div><br></div><div>//MainCORBAImpl.cpp</div><div><br></div><div>XServicePtr CMainCORBAImpl::GetXService()</div><div>{</div><div> try </div><div> {</div><div>  if(m_pServant== nullptr)</div><div>  {</div><div>      m_pServant= create_servant();</div><div>      PortableServer::ObjectId *oid = m_poa->activate_object(m_pServant.in()); // ref count=2</div><div><span style="white-space:pre">      </span>CORBA::Object_ptr retobj = m_poa->id_to_reference(*oid);</div><div><span class="" style="white-space:pre">      </span>m_XSvc= ::XService::_narrow(retobj);</div><div><span style="white-space:pre">      </span>m_pServant->_remove_ref();</div><div><br></div><div><span class="" style="white-space:pre">              </span>if (::CORBA::is_nil(m_XSvc))</div><div><span class="" style="white-space:pre">               </span>{</div><div>                     //throw exception</div><div>                }</div><div>  }</div><div> } </div><div> catch(...)</div><div> {</div><div>   //throw exception</div><div> }</div><div>  return m_XSvc;  </div><div>}</div><div><br></div><div>The multiple calls to GetXService() is causing crash. The debugger points to the following CORBA skeleton code</div><div><br></div><div><div>template<typename S_ptr,</div><div>         typename S_var,</div><div>         class Insert_Policy></div><div>CORBA::Boolean</div><div>TAO::Ret_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::marshal (TAO_OutputCDR &cdr)</div><div>{</div><div>  return cdr << this->x_.in ();</div><div>}</div></div><div><br></div><div>Thanks & Regards</div><div>Siddharth</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 29, 2015 at 3:58 PM, Christian Fromme <span dir="ltr"><<a href="mailto:christian@ast.dfs.de" target="_blank">christian@ast.dfs.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 29.09. 15:22, Siddharth Kulkarni wrote:<br>
> I am using ACE/TAO and having a general question regarding CORBA.<br>
> I am facing the scenario where the CORBA server need to return same CORBA<br>
> object again and again. I am facing server crash while returning the object<br>
> after two to three times.<br>
> I am creating and activating the object once and keep in memory. Then upon<br>
> client request returning the same object. Hence it is kind of singleton<br>
> object.<br>
> Can anybody suggest whether the given strategy is wrong? Then what is the<br>
> correct strategy in this scenario.<br>
<br>
</span>How exactly are you returning the object? (IDL and implementation code)<br>
<br>
Best,<br>
Christian<br>
</blockquote></div><br></div>