Summary: | CosNaming::NameComponent destructor causes crash | ||
---|---|---|---|
Product: | TAO | Reporter: | Mike Burkhart <mburkhart> |
Component: | orbsvcs | Assignee: | Marina Spivak <marina> |
Status: | CLOSED --- | ||
Severity: | critical | ||
Priority: | P2 | ||
Version: | 1.0 | ||
Hardware: | x86 | ||
OS: | Windows NT |
Description
Mike Burkhart
1999-09-28 11:00:38 CDT
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. |