[omniORB] CORBA::String_var in generated _dispatch method

RCS r-stadhe@online.no
Fri, 24 Nov 2000 21:05:29 +0100


This must be due to the fact that when an assignment to CORBA::String_var 
with a char * occurs, the String_var takes over the
responsibility of the char * object ( that is, String_var copies the 
POINTER to the string, a shallow copy ) , and thus String_var will also 
deallocate the place in memory pointed at by the copied char * pointer.

So in your code , the memory occupied by the char * value is deleted 
(deallocated) twice, namely by (_ORL_str_tmp or giop_s), and then by 
arg_service. Since the last one of these objects to try to delete the char 
* is attempting to delete a memory that is already deallocated, a crash 
results.

On the other hand, when a CORBA::String_var object is assigned a const char 
* value, it will make a copy of the value for itself to use ( a deep copy ) 
and will also deallocate this automatically, but now it is a legal 
deallocation.


This is my opinion (not a guarantee :-) ) of what is going on.

RCS