OK here is the back trace from gdb:
#0 0xffffe002 in ?? ()
#1 0x42028b93 in abort () from /lib/tls/libc.so.6
#2 0x41180b57 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.5
#3 0x41180ba4 in std::terminate() () from /usr/lib/libstdc++.so.5
#4 0x41180d16 in __cxa_throw () from /usr/lib/libstdc++.so.5
#5 0x4113a030 in std::__throw_logic_error(char const*) () from
/usr/lib/libstdc++.so.5
#6 0x41174107 in std::string& std::string::_M_replace_safe<char
const*>(__gnu_cxx::__normal_iterator<char*, std::string>,
__gnu_cxx::__normal_iterator<char*, std::string>, char const*, char
const*) () from /usr/lib/libstdc++.so.5
#7 0x41170374 in std::string::string(char const*, std::allocator<char>
const&) () from /usr/lib/libstdc++.so.5
#8 0x407f71a6 in osg::Window::frameInit() (this=0x8244c60) at
/usr/tmp/OpenSG_dist/OpenSG/Source/System/Window/OSGWindow.cpp:860
#9 0x407f79eb in osg::Window::render(osg::RenderAction*) (this=0x8244c60,
action=0x8245050) at
/usr/tmp/OpenSG_dist/OpenSG/Source/System/Window/OSGWindow.cpp:1127
#10 0x407d245a in osg::SimpleSceneManager::redraw() (this=0x8244db8) at
/usr/tmp/OpenSG_dist/OpenSG/Source/System/Window/OSGSimpleSceneManager.cpp:580
#11 0x4006dfb4 in display() () at test.c:427
#12 0x40f8a9b1 in processWindowWorkList () from /usr/lib/libglut.so.3
#13 0x40f8ac29 in glutMainLoop () from /usr/lib/libglut.so.3
#14 0x4006dc8a in loop(void*) (obj=0x0) at test.c:366
#15 0x40d6f506 in osg::BasePThreadBase::threadFunc(void*)
(pThreadArg=0x82552dc) at
/usr/tmp/OpenSG_dist/OpenSG/Source/Base/Base/OSGBaseThread.cpp:123
#16 0x40033332 in start_thread () from /lib/tls/libpthread.so.0
Also, i am not apposed to the idea of calling the whole display function
from the same, but not the main, thread of execution. However, on a
previous version of my attempts to multi-thread this program calling the
display function from a new thread caused the GLUTWindowPtr gwin=
GLUTWindow::create(); call to fail. So I tried to work around that by
just calling the glutMainLoop() function from the new thread.
Nerissa
On 28 Oct 2003, Gerrit Voss wrote:
>
> Hi,
>
> two things ;-) could you provide a stack trace where exactly
> the core dump happens. One thing where it might go wrong is
> within the X Window area as you create your window in
> a separate thread. I'll try to reproduce your setting without
> using python maybe this helps to figure out what went wrong.
>
> gerrit
>
>
> On Tue, 2003-10-28 at 15:44, Nerissa Oberlander wrote:
> > I have been working on a program that integrate OpenSG with Python. I
> > ran into some trouble with needing to display the scene graph, but still
> > wanting to continue to edi the scene graph. I have come to the
> > conclusion is that the best way to do this is to start a new thread to
> > run the display from and thus call the none thread releasing function
> > glutMainLoop(). After many atempts at different types of multi
> > threading, I finally got around to implementing OpenSG threading. Which
> > for the record has worked the best so far, but still doesn't do what I
> > need. I am getting the thread to start and even bring up a display
> > window, however, the redraw is causing problems. As in it crashes the
> > program and dumps a core. Here is the OpenSG code that I am currently
> > using:
> >
> > void loop(void *obj){
> > //GLUT main loop
> > printf("Starting main loop.\n");fflush(0);
> > glutMainLoop();
> > printf("Running...\n");fflush(0);
> >
> > }
> >
> > int Display(PyObject *scene){
> > void *scn;
> > int c = 1, i;
> > char **v;
> > for(i=0;i<10;i++){
> > v[i] = (char *)malloc(sizeof(char)*15);
> > }
> > v[0][0] = '.';
> > v[0][1] = '/';
> > v[0][2] = 't';
> > v[0][3] = 'e';
> > v[0][4] = 's';
> > v[0][5] = 't';
> >
> >
> > scn = PyCObject_AsVoidPtr(scene);
> > NodePtr *root = (NodePtr*)scn;
> >
> > // GLUT init
> > int winid = setupGLUT(&c, v);
> >
> > // the connection between GLUT and OpenSG
> > GLUTWindowPtr gwin= GLUTWindow::create();
> > beginEditCP(gwin);
> > gwin->setId(winid);
> > gwin->init();
> > endEditCP(gwin);
> >
> > // create the SimpleSceneManager helper
> > mgr = new SimpleSceneManager;
> >
> > // tell the manager what to manage
> >
> > mgr->setWindow(gwin );
> > mgr->setRoot(*root);
> >
> > // show the whole scene
> > mgr->showAll();
> >
> > // pthread_t thread;
> > //pthread_create(&thread, NULL, start_loop, NULL);
> > UInt32 myaspect = Thread::getAspect();
> >
> > Thread *display = Thread::get("Display_Thread");
> > display->runFunction( loop, myaspect, NULL );
> > return 0;
> > }
> >
> > When I call the glutMainLoop() function after the mgr the function works
> > fine, except for the part where it won't give me back my thread of
> > execution. When I run this code I have managed to track the problem
> > down to the redraw function:
> > //
> > // GLUT callback functions
> > //
> >
> > // redraw the window
> > void display(void)
> > {
> > printf("Redraw.\n");fflush(0);
> > mgr->redraw();
> > printf("Done redrawing.\n"); fflush(0);
> > }
> >
> > // react to size changes
> > void reshape(int w, int h)
> > {
> > printf("Reshape.\n");fflush(0);
> > mgr->resize(w, h);
> > printf("Done resizing.\n"); fflush(0);
> > glutPostRedisplay();
> > }
> >
> >
> > The resizing works just fine, but the display function causes issues.
> > Here is a sample run from my python module:
> >
> > [EMAIL PROTECTED]:~/cipic/rpve/beg]$ python
> > Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
> > [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import beg
> > >>> a = beg.SceneCreate()
> > >>> b = beg.cone(a)
> > >>> beg.Display(a)
> > Starting main loop.
> > 0
> > >>> Reshape.
> > Done resizing.
> > Redraw.
> > Aborted (core dumped)
> > [EMAIL PROTECTED]:~/cipic/rpve/beg]$
> >
> > Here is what happens if I don't try to separate the display into a
> > separate thread:
> >
> > [EMAIL PROTECTED]:~/cipic/rpve/beg]$ python
> > Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
> > [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import beg
> > >>> a = beg.SceneCreate()
> > >>> beg.Display(a)
> > [EMAIL PROTECTED]:~/cipic/rpve/beg]$
> >
> > Has anyone else been able to separate just the displaying of the scene
> > graph into a thread? Can anyone tell me what I doing wrong here?
> >
> > Nerissa
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: The SF.net Donation Program.
> > Do you like what SourceForge.net is doing for the Open
> > Source Community? Make a contribution, and help us add new
> > features and functionality. Click here: http://sourceforge.net/donate/
> > _______________________________________________
> > Opensg-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/opensg-users
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: The SF.net Donation Program.
> Do you like what SourceForge.net is doing for the Open
> Source Community? Make a contribution, and help us add new
> features and functionality. Click here: http://sourceforge.net/donate/
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users