[omniORB] CORBA Callback

Jesper Nordenberg jesper@nnl.se
Thu, 24 Feb 2000 13:12:32 +0100


I'm having some problems calling an object created by a client from the
server. The code looks like this:

client, main.cpp:
-----------------

  ORB_ptr orb = ORB_init(argc,argv,"omniORB2");
  BOA_ptr boa = orb->BOA_init(argc, argv, "omniORB2_BOA");

  try {
    boa->impl_is_ready(0, 1);
...
    Channel_ptr channel = manager->getChannel("Channel 1"); // Obtain
channel from server
    ChannelListener_i *listener = new ChannelListener_i("My Listener");
// Create new listener
    listener->_obj_is_ready(boa); // Register it with BOA
    channel->addListener(listener);  // Call object in server
...

server, main.cpp:
-----------------

  ORB_ptr orb = ORB_init(argc, argv, "omniORB2");
  BOA_ptr boa = orb->BOA_init(argc, argv, "omniORB2_BOA");
...
  boa->impl_is_ready();

server, Channel_i.cpp:
----------------------

void Channel_i::addListener(ChannelListener_ptr listener) {
  cout << "Adding listener" << endl;
  listeners[listenerCount++] = listener;
  cout << "Listener added: " << listener->getName() << endl; // Error!
}


It works ok until "listener->getName()" is called, then the client
exists with a segmentation fault. What am I doing wrong?

-- 
| Jesper Nordenberg, M.Sc. in C.S.E., jesper@nnl.se
| NNL Technology AB, www.nnl.se
| Phone: +46 13 211400
| Address: Teknikringen 1B, S-58330 Linköping, SWEDEN