Re: Seg fault in PortableServer_POA_activate_object function



Thanks for the suggestions Mark but I still can't work out the cause of the
error!

> K.
>
> Lots of things could be causing your segfault, but chances are you
> didn't initialize something properly or allocate space for your ev
> struct.  It's hard to say without seeing your code.

My server code looks very similar to your example below. This is part of the
main function:
...
...

  CORBA_Environment*        ev;
...
...

  ev = g_new0(CORBA_Environment,1);

   CORBA_exception_init(ev);

   orb = CORBA_ORB_init(&argc, argv, "orbit-local-orb", ev);
   //debug statement
   printf("Initialised orb\n");

   root_poa = (PortableServer_POA)CORBA_ORB_resolve_initial_references(orb,
"RootPOA", ev);
   //debug statement
   printf("Initialised poa\n");

   calculator = impl_Calculator__create(root_poa, ev);
   //debug statement
   printf("Created calculator\n");
...
...


When I run this, the output to the screen is:
Initialised orb
Initialised poa
Segmentation fault (core dumped)

I've checked and triple checked everything and it looks correct so any other
ideas?

Katherine

>
>
> A while ago I wrote a similar test program (only for ORBit 0.5.12) with
> an interface called Fortune to return fortunes from remote servers.  My
> server initialization code looked something like this:
>
> #define THROW if (ev->_major != CORBA_NO_EXCEPTION) {           \
> g_error("CORBA Exception:  %s", CORBA_exception_id(ev)); }
>
> ...
>
>     /* Initialize the CORBA environment. */
>
>     ev = g_new0(CORBA_Environment, 1);
>     CORBA_exception_init(ev);
>     THROW;
>     orb = CORBA_ORB_init(&argc, argv, "orbit-local-orb", ev);
>     THROW;
>
>     /* Snag the root POA and instantiate my server. */
>     root_poa = (PortableServer_POA)CORBA_ORB_resolve_initial_references
>         (orb, "RootPOA", ev);
>     THROW;
>     fortune = impl_Fortune__create(root_poa, ev);
>     THROW;
>
> Notice two things:  first, I've allocated space for my ev struct;
> second, I *always* checked for failures after each ORB call that might
> report one...  It's possible you're trying to use the root POA after
> having failed to get a reference.




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