Re: ORBit2 and checking CORBA_Environent's



Martin Baulig <martin home-of-linux org> writes:

> Hi guys,
> 
> as you all probably know you must check the CORBA_Environment on
> every CORBA call, especially if it has a return value.
> 
> However, with ORBit 0.5.x you could assume that a CORBA method
> will return NULL on an exception, for instance the following
> was "allowed" and it always returned CORBA_OBJECT_NIL if there
> was an exception:
> 
> ====
> Bonobo_Unknown hello (void)
> {
>     CORBA_Environment ev;
> 
>     CORBA_exception_init (&ev);
>     foo = bonobo_get_object ("something", "Bonobo/Unknown", &ev)
>     CORBA_exception_free (&ev);
> 
>     return foo;
> }
> =====
> 
> With ORBit2 this doesn't work anymore - you get "something" as return
> value (an invalid pointer).
> 
> Even if this is allowed according to the CORBA spec, shouldn't we change
> this to the GNOME 1.x behaviour - returning an invalid pointer which
> points to some random location in memory will just cause semi-random and
> hard to find crashes.

Well, except for the semi-random and hard-to-find bits, I think
causing crashes in this circumstance is good. Perhaps we should always
return, say, (CORBA_Object)0xbad in this case to get something that
is:
 
 - reliably non-null
 - In the first page, so segfaulting as fast as possible 

I don't think we should be encouraging people to write code that
is invalid according to the CORBA spec.

Regards,
                                        Owen 





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