[osg-users] osgViewer crashes at inserting string into stream inside Renderer::draw() (Win10, osg3.2.0, compiler vc10)

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Wed Mar 18 07:13:17 PDT 2020


Hello everyone,

recently I encountered a sporadic crash in my App at same position upon 
calling function Renderer::draw() in osgViewer/Renderer.cpp. The crash 
happend at 

*  DEBUG_MESSAGE<<"draw() got SceneView "<<sceneView<<std::endl; *(screenshots 
of callstack are attached)
 
and triggerd an exception via a string of basic streambuf operations very 
deep down to msvcp100d.dll in dbgheap.c

        * /**
*         * If this ASSERT fails, a bad pointer has been passed in. It may 
be*
*         * totally bogus, or it may have been allocated from another heap.*
*         * The pointer MUST come from the 'local' heap.*
*         */*
*        _ASSERTE(_CrtIsValidHeapPointer(pUserData)); * ----> assertion 
error thrown, the heap pointer is invalid

In debug session I checked the call stack step by step and found that when 
putting "*draw() got SceneView*" in stringbuffer, functoin overflow of 
std::basic_stringbuf is triggerd, and subsequently
the deallocate step at :
                        *if (_Mystate & _Allocated)*
* _Al.deallocate(_Oldptr, _Oldsize);*
* _Mystate |= _Allocated;*
was executed. it tried to deallocate the buffer, pointed by "_Oldptr" with 
size "_Oldsize". But the size is smaller than the actual buffer length. 
Therefore the assertion error above was thrown.

Info to my App:
I enhance the viewer with osgWidget::WindowManager. My App recieves 
external data cyclic and renders boxes and lines in one data transmission 
framework. The API of this framework calls my viewer to render every 20ms, 
an example of this call:
   framework::call_on_cycle () {  // main thread
                   // process and storing incoming data
                   process_data();
                   myViewer->frame();
 }
 
My App runs at DrawThreadPerContext mode and updates drawables in callback 
and setting them as DYNAMIC.

Is there anyone ever facing similar Problem? Or any ideas to analyse or 
sort this out? I will really appreciate any help.

Thank you

Regards,
Yuan


-- 
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/b0bac75e-6cdb-47f7-9ede-1e8aa931af4c%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200318/a51f017b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash_callstack_1.png
Type: image/png
Size: 99065 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200318/a51f017b/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash_callstack_2.png
Type: image/png
Size: 99259 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200318/a51f017b/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash_callstack_3.png
Type: image/png
Size: 96742 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200318/a51f017b/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crash_callstack_4.png
Type: image/png
Size: 106125 bytes
Desc: not available
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200318/a51f017b/attachment-0007.png>


More information about the osg-users mailing list