Allocating and deallocating sequences of objects



Hi everybody,
thank to this list some of my questions found an answer, but I've still got
some.

I created a sequence of structure on the server side. This structure is
formed by an Object
(well, a reference) and two CORBA_long.
When I need to add a new element to the sequence I allocate another buffer
(with length=old length+1), copy all the old elements and add the new one.
To copy all the old elements (each containing an Object reference) I also
need to
call a CORBA_Object_duplicate(). To complete the copy correctly I need to
deallocate the old buffer,
and calling a CORBA_free() should do all the work, including the
Object_release() on the old references.
Isn't it?
But: why does my system segfault if I call the Object_release() on the old
references before calling the CORBA_free()?

And: if I don't need anymore an element of the list I must destroy it, but
how can I do it?
I don't think that an Object_release() suffices, because the servant
structure needs to be deallocated,
and the idl compiler produces for this the function impl_MyObject_destroy().
I should call this? Before or after the Object_release()?

Thanks for your fundamental help,

Ale




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]