[prev in list] [next in list] [prev in thread] [next in thread] 

List:       omniorb-list
Subject:    [omniORB] Re: Sequences and Java Client
From:       David Riddoch <djr () uk ! research ! att ! com>
Date:       1999-02-12 16:57:11
[Download RAW message or body]


On Fri, 12 Feb 1999, Armen Yampolsky wrote:

> Is it sensible to hold the reference to the Echos' sequence? I am doing that
> by calling its copy constructor just prior to returning it (I am returning
> the copy, and holding the reference to the original)?

This sounds okay. You just have to remember that the sequence you return
from EchoList::getEchos() will be freed by the ORB (using delete), so it
MUST be heap allocated, and you must not hold onto that pointer.

I assume you're doing something like:

Echoseq*
EchoList_i::getEchos()
{
  Echoseq* seq = new Echoseq();

  ... initialise the sequence ...
  ... store <seq> somewhere ...

  return new Echoseq(*seq);
}

This will duplicate the references to the Echo objects appropriately.


David

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic