<div dir="ltr">Does the code crash whether you enable or disable the debug output?<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 31 Mar 2020 at 08:15, OpenSceneGraph Users <<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello everyone,<div><br></div><div>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 </div><div><br></div><div><i>  <font size="2">DEBUG_MESSAGE<<"draw() got SceneView "<<sceneView<<std::endl;</font> </i>(screenshots of callstack are attached)</div><div> </div><div>and triggerd an exception via a string of basic streambuf operations very deep down to msvcp100d.dll in dbgheap.c</div><div><br></div><div><div>        <i> /*</i></div><div><i>         * If this ASSERT fails, a bad pointer has been passed in. It may be</i></div><div><i>         * totally bogus, or it may have been allocated from another heap.</i></div><div><i>         * The pointer MUST come from the 'local' heap.</i></div><div><i>         */</i></div><div><i>        _ASSERTE(_CrtIsValidHeapPointer(pUserData)); </i> ----> assertion error thrown, the heap pointer is invalid</div></div><div><br></div><div>In debug session I checked the call stack step by step and found that when putting "<i>draw() got SceneView</i>" in stringbuffer, functoin overflow of std::basic_stringbuf is triggerd, and subsequently</div><div>the deallocate step at :</div><div><div>                        <i>if (_Mystate & _Allocated)</i></div><div><i><span style="white-space:pre-wrap">                            </span>_Al.deallocate(_Oldptr, _Oldsize);</i></div><div><i><span style="white-space:pre-wrap">                    </span>_Mystate |= _Allocated;</i></div></div><div>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.</div><div><br></div><div>Info to my App:</div><div>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:</div><div>   framework::call_on_cycle () {  // main thread</div><div>                   // process and storing incoming data</div><div>                   process_data();</div><div>                   myViewer->frame();</div><div> }</div><div> </div><div>My App runs at DrawThreadPerContext mode and updates drawables in callback and setting them as DYNAMIC.</div><div><br></div><div>Is there anyone ever facing similar Problem? Or any ideas to analyse or sort this out? I will really appreciate any help.</div><div><br></div><div>Thank you</div><div><br></div><div>Regards,</div><div>Yuan</div><div><br></div><div><i><br></i></div></div>

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:osg-users+unsubscribe@googlegroups.com" target="_blank">osg-users+unsubscribe@googlegroups.com</a>.<br>
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/osg-users/b0bac75e-6cdb-47f7-9ede-1e8aa931af4c%40googlegroups.com?utm_medium=email&utm_source=footer" target="_blank">https://groups.google.com/d/msgid/osg-users/b0bac75e-6cdb-47f7-9ede-1e8aa931af4c%40googlegroups.com</a>.<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div>