Hey folks, I have the following code (extracts):
header (for soapcpp2): class stringArray { public: std::string **__ptr; int __size; stringArray(); void add(std::string str, struct soap * soap); void add(std::string * str, struct soap * soap); void resize(struct soap * soap); }; void stringArray::resize(struct soap * soap) { std::string **newPtr = (std::string **)soap_new_std__string(soap, __size + 5); // Copy any existing array to the new array and free the old array. if (__ptr) { newPtr = __ptr; soap_delete(soap, __ptr); } __ptr = newPtr; } void stringArray::add(string * str, struct soap * soap) { // If this is the first time through, or we have exhausted the current array limit, then // reallocate the array. if (__size == 0 || (__size % 5) == 0) { resize(soap); } *(__ptr)[__size] = *str; __size++; } void stringArray::add(string str, struct soap * soap) { add(&str, soap); } when I run my program, I get the following crash: (gdb) b stringArray.cpp:72 Breakpoint 1 at 0x80adc17: file /root/nm2/stringArray.cpp, line 72. (gdb) run ... Breakpoint 1, stringArray::add (this=0xb62e8304, str=0xb62e8244, soap=0x8f48838) at /root/nm2/stringArray.cpp:72 72 *(__ptr)[__size] = *str; (gdb) n Program received signal SIGSEGV, Segmentation fault. 0x00ca29e9 in __gnu_cxx::__exchange_and_add () from /usr/lib/libstdc++.so.6 (gdb) bt #0 0x00ca29e9 in __gnu_cxx::__exchange_and_add () from /usr/lib/libstdc++.so.6 #1 0x00c85883 in std::string::assign () from /usr/lib/libstdc++.so.6 #2 0x00c858f4 in std::string::operator= () from /usr/lib/libstdc++.so.6 #3 0x080adc3a in stringArray::add (this=0xb62e8304, str=0xb62e8244, soap=0x8f48838) at /root/nm2/stringArray.cpp:72 #4 0x080adc6f in stringArray::add (this=0xb62e8304, [EMAIL PROTECTED], soap=0x8f48838) at /root/nm2/stringArray.cpp:82 #5 0x080e8b55 in ns1__myservice (soap=0x8f48838, value=1) at services.cpp:906 #6 0x080feb9d in soap_serve_ns1__myservice (soap=0x8f48838) at soapServer.cpp:917 #7 0x081029af in soap_serve_request (soap=0x8f48838) at soapServer.cpp:111 #8 0x0810353b in soap_serve (soap=0x8f48838) at soapServer.cpp:49 #9 0x080b97da in process_queue (soap=0x8f48838) at myserver.cpp:228 #10 0x009a245b in start_thread () from /lib/libpthread.so.0 #11 0x007c223e in clone () from /lib/libc.so.6 I'm at my wits end with this one. I've done some google searches for "__exchange_and_add SIGSEGV", but not much turned up... certainly no resolutions. Any ideas as to what I might be doing wrong or what could be the issue? Are there any workarounds or alternate approaches I can take? gsoap is 2.7.10 - didn't see any mention of this being an issue in recent times with gsoap so haven't yet pursued updating. /usr/lib/libstdc++.so.6 is from libstdc++-4.1.2-13.fc6 -- old, yes, but it's what we have to work with. Cheers! Jon