Hi!
I've run into another problem. This concerns changelist corruption.
I'm currently stress testing my application and it crashes within a
minute or two. And this is due to changelist corruption and/or due to
lousy object deletion :). The size of the program gets bigger and bigger
during execution.
The thread that runs the glut main loop looks like this:
///// OpenSGClient.cpp
....
// callSync is used to synchronize data from the external thread into
// the glut main thread.
void OpenSGClient::callSync(){
std::cout << "callSync called\n";
syncBarrier = Barrier::get(NULL);
needSync = true;
syncBarrier->enter(2);
syncBarrier->enter(2);
}
void OpenSGClient::display(){
if(needSync==true) {
needSync = false;
std::cout << "display have recieved a needSync\n";
syncBarrier->enter(2);
std::cout << "display is syncing\n";
// this line allows new objects to be added to the scenery
Thread::getCurrentChangeList()->merge(*clientHandle->getChangeList());
// this line is used get information of object removal from the scene
clientHandle->getChangeList()->applyAndClear();
syncBarrier->enter(2);
}
mgr->redraw();
OSG::Thread::getCurrentChangeList()->clearAll();
glClear(GL_COLOR_BUFFER_BIT);
glutSwapBuffers();
}
....
////
In the other thread I use a while(true) loop that first removes all
objects on the scene. Synchronizes with the other thread. Then it adds a
random number of objects to the scene, and synchronizes with the other
thread. This works, but after a random time from one second to two
minutes the program crashes with the error:
terminate called after throwing an instance of
'osg::BinaryDataHandler::ReadError'
what(): BinaryDataHandler ReadError: Channel closed
I get this error when the glut-thread is trying to merge or get the
changelist from the other thread.
The loop thread looks like this:
/////// Main.cpp
....
while(true){
//// temporary blob-removal
std::cout << "clean old dots\n";
printf("Number of active blobs: %d\n",activeBlobs.size());
if (activeBlobs.size()>0){
// get the root
NodePtr rootNode = getClient()->getRoot();
beginEditCP(rootNode);
// remove all of the roots children
int j = activeBlobs.size();
for (int i = 0;i<j;i++){
rootNode->subChild(activeBlobs.at(i));
// ensure child deletion (?)
subRefCP(activeBlobs.at(i));
}
endEditCP(rootNode);
activeBlobs.clear();
// Syncronization of changeLists
getClient()->callSync();
// get the client changelist - to ensure both
// changelists are identical (?)
getClientThread()->getChangeList()->applyAndClear();
}
//// end of temporary blob-removal
**** add objects to the scene ****
} // end of while loop
....
////
Any suggestions?
Many thanks!
// Martin
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users