On Sun, 2006-05-07 at 11:26 -0400, Anthony DeRobertis wrote: > Sorry for taking so long on this. Anyway, here it is: > > Program received signal SIGSEGV, Segmentation fault. > [Switching to Thread 46912570136816 (LWP 7679)] > 0x00002aaaae65701f in memcpy () from /lib/libc.so.6 > (gdb) bt > #0 0x00002aaaae65701f in memcpy () from /lib/libc.so.6 > #1 0x000000000054d29d in > std::string::_S_construct<__gnu_cxx::__normal_iterator<char*, std::string> > > (__beg={_M_current = 0xff24e8 " layers groups"}, > __end=<value optimized out>, __a=<value optimized out>) > at char_traits.h:269 > #2 0x000000000054d2d9 in basic_string<__gnu_cxx::__normal_iterator<char*, > std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > ( > this=0x7fffffcfad70, __beg={_M_current = 0x2aaab1232b28 ""}, __end= > {_M_current = 0x1032fe8 ""}, [EMAIL PROTECTED]) at basic_string.h:1444 > #3 0x0000000000553460 in studio::DockDialog::set_contents (this=0xfe24c0, > z=<value optimized out>) at dockdialog.cpp:506 [...]
That line (506) in dockdialog.cpp looks like this: book_contents=String(str.begin(),str.begin()+separator); This should throw std::length_error if, for example, the first iterator would go beoynd the second. I don't know exactly what will happen if the second iterator is advanced beyond the length of the string. Maybe that's the problem. Anthony, any chance you could try the following things: * Could you compile the attached file (g++ -g -o test test.cpp) and run it under gdb? If it crashes in the same way, we have a smaller test case to work with. * Could you apply the attached patch to src/gtkmm/dockdialog.cpp, recompile and provide the output? Or put a gdb breakpoint at dockdialog.cpp:506 and then print the value of str and separator? Sorry I can't provide the package with that debugging patch built in, but network connectivity is a bit limited here at debcamp6. -- Fabian Fagerholm <[EMAIL PROTECTED]>
#include <iostream> #include <string> using namespace std; int main() { string str1 = string("abcdefghi"); unsigned int separator = str1.find_first_of('e'); string str2 = string(str1.begin(), str1.begin() + separator); cout << str1 << " " << separator << endl; cout << str2 << endl; for (int i = 0; i < 64; i++) { string str3 = string(str1.begin(), str1.begin() + separator + i); cout << str3 << " (i == " << i << ")" << endl; } return 0; }
Index: dockdialog.cpp =================================================================== --- dockdialog.cpp (revision 132) +++ dockdialog.cpp (working copy) @@ -503,6 +503,8 @@ } else { + cout << "DEBUG: str.begin() == " << str.begin() << endl; + cout << "DEBUG: separator == " << separator << endl; book_contents=String(str.begin(),str.begin()+separator); str=String(str.begin()+separator+1,str.end()); }
signature.asc
Description: This is a digitally signed message part