longtree
asked on
TAO Corba client crash
Hi,
I wrote a simple client/server based on the chat example in the tao/examples/simple/chat directory, using ACE-6.0.0 win32.
The client seems to run fine, but when main ends as it's running its destructors it crashes on an access violation at
Line 33 in leader_follower.cpp
if ( this->orb_core_->gui_resou rce_factor y () )
this->orb_core_->gui_resou rce_factor y ()->reclaim_reactor (this->reactor_);
I'm not sure if its relevant but my client access is done through a secondary class that's instantiated from a dll. So the orb init code resides in the dll too.
This is my basic initialization code in the dll:
int argc;
ACE_TCHAR** argv = CommandLineToArgvA(GetComm andLine(), &argc);
orb_ = CORBA::ORB_init (argc, argv);
// Open the file for reading.
ACE_HANDLE f_handle = ACE_OS::open (ior_filename, 0);
if (f_handle != ACE_INVALID_HANDLE) {
ACE_Read_Buffer ior_buffer (f_handle);
char *data = ior_buffer.read ();
if (data != 0) {
CORBA::Object_var server_object =
orb_->string_to_object (data);
__symbols = Symbols::_narrow (server_object.in ());
if (!CORBA::is_nil (__symbols.in ())) __order_sync_init_successf ul=true;
}
ior_buffer.alloc ()->free (data);
ACE_OS::close (f_handle);
}
and this is the final code:
orb_ ->shutdown();
I wrote a simple client/server based on the chat example in the tao/examples/simple/chat directory, using ACE-6.0.0 win32.
The client seems to run fine, but when main ends as it's running its destructors it crashes on an access violation at
Line 33 in leader_follower.cpp
if ( this->orb_core_->gui_resou
this->orb_core_->gui_resou
I'm not sure if its relevant but my client access is done through a secondary class that's instantiated from a dll. So the orb init code resides in the dll too.
This is my basic initialization code in the dll:
int argc;
ACE_TCHAR** argv = CommandLineToArgvA(GetComm
orb_ = CORBA::ORB_init (argc, argv);
// Open the file for reading.
ACE_HANDLE f_handle = ACE_OS::open (ior_filename, 0);
if (f_handle != ACE_INVALID_HANDLE) {
ACE_Read_Buffer ior_buffer (f_handle);
char *data = ior_buffer.read ();
if (data != 0) {
CORBA::Object_var server_object =
orb_->string_to_object (data);
__symbols = Symbols::_narrow (server_object.in ());
if (!CORBA::is_nil (__symbols.in ())) __order_sync_init_successf
}
ior_buffer.alloc ()->free (data);
ACE_OS::close (f_handle);
}
and this is the final code:
orb_ ->shutdown();
ofcourse if you don't have a debugger then insert a few log statements to help you with the flow and the crash location
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I figured it out myself and that was the reason.
if you have access to a debugger place a breakpoint before the place where it is crashing and check which pointer is going NULL
otherwise do the following. check my code snippet below. I'm just checking for NULL so that you can isolate the problem further
Open in new window