From: Bruce S. <ba...@an...> - 2002-04-26 13:40:39
|
Here is some nice detective work by Yves Bailly in France. I should incorporate his change, but in the meantime here is what he found. I'm puzzled that others running on Debian did not run into this problem. Bruce Sherwood --On Friday, April 26, 2002 1:57 AM +0200 Yves BAILLY <kaf...@ne...> wrote: > Hello, > > First of all, I have to say : contragulation for your great work ! > > Now, my problem : > I tried to install VPython on a Debian "sid", using : > - Python 2.2.1 > - Numeric 21.0 > - GtkGlArea 1.2.3 > - Mesa which comes with XFree86 4.1.0 > > Everything compiles fine, but when running > from visual import * > ...I was always getting a segfault. > > I dig a little bit, and found this in cvisual/CXX/Src/cxx_extensions.cxx = : > void PythonType::name( const char* nam ) > { > table->tp_name =3D const_cast<char *>( name ); > } > The segfault seemed to occure during this method. > > Considering the char* is a rather strange thing, that should always be > used with care, moreover when you give a litteral string to a function, > I just modified this method a little, to allocate and duplicate the > string : > void PythonType::name( const char* nam ) > { > char* str =3D new char[strlen(nam)+1] ; > strcpy(str, nam) ; > table->tp_name =3D const_cast<char *>( str ); > } > > ...and now it works fine, I can even use the KineticsKit ! > > Just a quick hack, for sure there should something better (nicer). > > Best regards, > > -- > (=B0< | Yves Bailly : http://kafka-fr.net | -=B0) > //\ | Linux Dijon : http://www.coagul.org | //\ > \_/ | Don d'organe : http://adot21.free.fr | \_/` |