Please report new issues athttps://github.com/DOCGroup
Simply creating and destroying an instance of CosNaming::NameComponent causes a program crash. The source code looks like this: CosNaming::NameComponent *name_component; name_component->id = "IpcManager"; name_component->kind = ""; . . . delete name_component; The stack trace shows the crash is occuring in the destructor for NameComponent: operator delete(void * 0x0043e76c) line 47 + 81 bytes CORBA::string_free(char * 0x0043e76c) line 14 + 15 bytes TAO_String_Manager::~TAO_String_Manager() line 37 + 11 bytes CosNaming::NameComponent::~NameComponent() + 47 bytes IpcServerObj::Connect(const char * 0x0107ae63, int 0x00000000) line 216 + 76 bytes ace_main_i(int 0x00000002, char * * 0x0107ae50) line 122 + 20 bytes main(int 0x00000002, char * * 0x0107ae50) line 77 + 69 bytes mainCRTStartup() line 338 + 17 bytes KERNEL32! 77f1ba3c()
This is related to the Naming Service.
Oops. orbsvcs, but Marina's neverthless.
Actually i believe this is a bug in the user's code, i have asked him to test a change, my guess is that this bug is going into the NOT_A_BUG category.
The problem is in the user's code: the right side of the assignment to a struct member of type string should be either a const char * or dynamically allocated string (i.e., char *), e.g., name_component->id = (const char *)"Ipc_Manager"; or name_component->id = CORBA::string_dup ("IpcManager"); In the first case, since the item on the right side of assignment is const, a copy of it is created and memory-managed by the struct. In the second case, struct takes ownership of the passed string, and will deallocate it when necessary. The reason name_component->id = "IpcManager"; doesn't work is because many compilers treat literal string (e.g., "IpcManager") as a char*, not const char*! So the struct takes ownership of the passed string literal without duplicating it, and attempts to delete it in its destructor ;(
You guys were right on, the problem was my fault. Thank you for the quick response. Sorry to waste your time with my programming errors!
Not a bug. Close.