Victor Haefner
2014-11-07 11:48:07 UTC
Hi,
I updated the OpenSG version of my Project (from an older v2 to the current
one)
Now I have massive problems with strange segfaults:
Valgrind:
InvalidWrite|====|Invalid write of size 1|
||Call stack:|
/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h|161|0x709B8D: void
OSG::TypedGeoIntegralProperty<OSG::GeoUInt8PropertyDesc>::push_back<int>(int
const&)|
/usr/lib/opensg/libOSGDrawable.so.2.0.0||0x11E7D48D:
OSG::makeSphereGeo(unsigned short, float)|
/home/victor/Projects/polyvr/src/PolyVR.cpp|74|0x7A8EF1:
OSG::initPolyVR(int, char**)|
/home/victor/Projects/polyvr/src/main.cpp|18|0x57E845: main|
||Address 0x0 is not stack'd, malloc'd or (recently) free'd|
||Valgrind found 1 errors!|
Backtrace:
#0 0x709b8d setValue<int>(index=0, val=4, this=0x7fffc96f5e10)
(/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h:161)
#1 ?? OSG::TypedGeoIntegralProperty<OSG::GeoUInt8PropertyDesc>::push_back<int>
(this=0x7fffc96f5e10, val=<optimized out>)
(/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h:176)
#2 0x7fffeb43348e OSG::makeSphereGeo(unsigned short, float) ()
(/usr/lib/opensg/libOSGDrawable.so.2.0.0:??)
#3 0x7a8ef2 OSG::initPolyVR(argc=***@entry=1, argv=***@entry=0x7fffffffe2d8)
(PolyVR.cpp:74)
#4 0x57e846 main(argc=1, argv=0x7fffffffe2d8) (main.cpp:18)
Now comes the strange part:
- The problem occured on all machines I tried it on, Ati, Nvidia, but all
Ubuntu 14.04
- The problem vanishes when I comment this type of code throughout my
project files:
GeoUInt8PropertyRecPtr Type = GeoUInt8Property::create();
GeoUInt32PropertyRecPtr Length = GeoUInt32Property::create();
GeoPnt3fPropertyRecPtr Pos = GeoPnt3fProperty::create();
GeoVec3fPropertyRecPtr Norms = GeoVec3fProperty::create();
GeoUInt32PropertyRecPtr Indices = GeoUInt32Property::create();
SimpleMaterialRecPtr Mat = SimpleMaterial::create();
GeoVec2fPropertyRecPtr Tex = GeoVec2fProperty::create();
Type->addValue(type);
Length->addValue(inds.size());
//positionen und Normalen
for(uint i=0;i<pos.size();i++) {
Pos->addValue(pos[i]);
Norms->addValue(norms[i]);
if (texs.size() == pos.size()) Tex->addValue(texs[i]);
}
for(uint i=0;i<inds.size();i++) {
Indices->addValue(inds[i]);
}
Mat->setDiffuse(Color3f(0.8,0.8,0.6));
Mat->setAmbient(Color3f(0.4, 0.4, 0.2));
Mat->setSpecular(Color3f(0.1, 0.1, 0.1));
GeometryRecPtr geo = Geometry::create();
geo->setTypes(Type);
geo->setLengths(Length);
geo->setIndices(Indices);
geo->setPositions(Pos);
geo->setNormals(Norms);
geo->setTexCoords(Tex);
geo->setMaterial(Mat);
Just by having this code in the executale produces the crashes..
I don't even call it.
- If I comment the code above my project starts, I can import COLLADA files
and create primitive geometries, but I still get random segfaults..
- All of this must be related to some recent changes in OpenSG
I will continue to search, but I am running out of ideas :(
UPDATE: The above is still valid, I refined it to the following:
osgInit(argc,argv);
GeoUInt8PropertyRecPtr Type = GeoUInt8Property::create();
Type->addValue(GL_LINES); // <-- segfault here
#0 ?? OSG::initPolyVR (argc=***@entry=1, argv=***@entry=0x7fffffffe2d8)
#1 0x57e7c6 main(argc=1, argv=0x7fffffffe2d8)
InvalidWrite|====|Invalid write of size 1|
||Call stack:|
/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h|161|0x7A97B3:
OSG::initPolyVR(int, char**)|
/home/victor/Projects/polyvr/src/main.cpp|18|0x57E7C5: main|
||Address 0x0 is not stack'd, malloc'd or (recently) free'd|
||Valgrind found 1 errors!|
UPDATE 2: get the same with 09geometry_water2.cpp
#0 0x40be92 setValue<int>(index=0, val=7, this=0x7fffd9233b40)
(/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h:161)
#1 ?? push_back<int> (val=<optimized out>, this=0x7fffd9233b40)
(/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h:176)
#2 ?? addValue<int> (val=<optimized out>, this=0x7fffd9233b40)
(/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h:169)
#3 ?? createScenegraph () (/home/victor/Projects/polyvr/src/main.cpp:48)
#4 0x40b333 main(argc=1, argv=<optimized out>) (09geometry_water2.cpp:123)
Best regards,
Victor
I updated the OpenSG version of my Project (from an older v2 to the current
one)
Now I have massive problems with strange segfaults:
Valgrind:
InvalidWrite|====|Invalid write of size 1|
||Call stack:|
/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h|161|0x709B8D: void
OSG::TypedGeoIntegralProperty<OSG::GeoUInt8PropertyDesc>::push_back<int>(int
const&)|
/usr/lib/opensg/libOSGDrawable.so.2.0.0||0x11E7D48D:
OSG::makeSphereGeo(unsigned short, float)|
/home/victor/Projects/polyvr/src/PolyVR.cpp|74|0x7A8EF1:
OSG::initPolyVR(int, char**)|
/home/victor/Projects/polyvr/src/main.cpp|18|0x57E845: main|
||Address 0x0 is not stack'd, malloc'd or (recently) free'd|
||Valgrind found 1 errors!|
Backtrace:
#0 0x709b8d setValue<int>(index=0, val=4, this=0x7fffc96f5e10)
(/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h:161)
#1 ?? OSG::TypedGeoIntegralProperty<OSG::GeoUInt8PropertyDesc>::push_back<int>
(this=0x7fffc96f5e10, val=<optimized out>)
(/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h:176)
#2 0x7fffeb43348e OSG::makeSphereGeo(unsigned short, float) ()
(/usr/lib/opensg/libOSGDrawable.so.2.0.0:??)
#3 0x7a8ef2 OSG::initPolyVR(argc=***@entry=1, argv=***@entry=0x7fffffffe2d8)
(PolyVR.cpp:74)
#4 0x57e846 main(argc=1, argv=0x7fffffffe2d8) (main.cpp:18)
Now comes the strange part:
- The problem occured on all machines I tried it on, Ati, Nvidia, but all
Ubuntu 14.04
- The problem vanishes when I comment this type of code throughout my
project files:
GeoUInt8PropertyRecPtr Type = GeoUInt8Property::create();
GeoUInt32PropertyRecPtr Length = GeoUInt32Property::create();
GeoPnt3fPropertyRecPtr Pos = GeoPnt3fProperty::create();
GeoVec3fPropertyRecPtr Norms = GeoVec3fProperty::create();
GeoUInt32PropertyRecPtr Indices = GeoUInt32Property::create();
SimpleMaterialRecPtr Mat = SimpleMaterial::create();
GeoVec2fPropertyRecPtr Tex = GeoVec2fProperty::create();
Type->addValue(type);
Length->addValue(inds.size());
//positionen und Normalen
for(uint i=0;i<pos.size();i++) {
Pos->addValue(pos[i]);
Norms->addValue(norms[i]);
if (texs.size() == pos.size()) Tex->addValue(texs[i]);
}
for(uint i=0;i<inds.size();i++) {
Indices->addValue(inds[i]);
}
Mat->setDiffuse(Color3f(0.8,0.8,0.6));
Mat->setAmbient(Color3f(0.4, 0.4, 0.2));
Mat->setSpecular(Color3f(0.1, 0.1, 0.1));
GeometryRecPtr geo = Geometry::create();
geo->setTypes(Type);
geo->setLengths(Length);
geo->setIndices(Indices);
geo->setPositions(Pos);
geo->setNormals(Norms);
geo->setTexCoords(Tex);
geo->setMaterial(Mat);
Just by having this code in the executale produces the crashes..
I don't even call it.
- If I comment the code above my project starts, I can import COLLADA files
and create primitive geometries, but I still get random segfaults..
- All of this must be related to some recent changes in OpenSG
I will continue to search, but I am running out of ideas :(
UPDATE: The above is still valid, I refined it to the following:
osgInit(argc,argv);
GeoUInt8PropertyRecPtr Type = GeoUInt8Property::create();
Type->addValue(GL_LINES); // <-- segfault here
#0 ?? OSG::initPolyVR (argc=***@entry=1, argv=***@entry=0x7fffffffe2d8)
#1 0x57e7c6 main(argc=1, argv=0x7fffffffe2d8)
InvalidWrite|====|Invalid write of size 1|
||Call stack:|
/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h|161|0x7A97B3:
OSG::initPolyVR(int, char**)|
/home/victor/Projects/polyvr/src/main.cpp|18|0x57E7C5: main|
||Address 0x0 is not stack'd, malloc'd or (recently) free'd|
||Valgrind found 1 errors!|
UPDATE 2: get the same with 09geometry_water2.cpp
#0 0x40be92 setValue<int>(index=0, val=7, this=0x7fffd9233b40)
(/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h:161)
#1 ?? push_back<int> (val=<optimized out>, this=0x7fffd9233b40)
(/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h:176)
#2 ?? addValue<int> (val=<optimized out>, this=0x7fffd9233b40)
(/usr/local/include/OpenSG/OSGTypedGeoIntegralProperty.h:169)
#3 ?? createScenegraph () (/home/victor/Projects/polyvr/src/main.cpp:48)
#4 0x40b333 main(argc=1, argv=<optimized out>) (09geometry_water2.cpp:123)
Best regards,
Victor