Quantcast

Debug Assertion Failed!

classic Classic list List threaded Threaded
7 messages Options
Daven Hem Daven Hem
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Debug Assertion Failed!

Hello, everyone!
I just experienced "Debug Assertion Failed" error when I repeated to add about 100 childs to root node and remove 60 childs from root node.
I don't know the reason. Please help me.
Thanks.

************************************************************
Error:
Debug Assertion Failed!
Program: D:\osgEarth\bin\Debug\MSVCP120D.dll
File: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector
Line: 1952

Expression: vector<bool> iterator not dereferencable

For information on how your program can cause an assertion failure, see the
Visual C++ documentation on asserts.

(Press Retry to debug the application)

************************************************************

Daven Hem Daven Hem
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Debug Assertion Failed!

Please teach me, Glenn.
Thanks.
Daven.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Debug Assertion Failed!

I'd venture there is a bug in your code somewhere. Other than that I don't have any particular advice.
Glenn Waldron / Pelican Mapping / @glennwaldron
Daven Hem Daven Hem
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Debug Assertion Failed!

Hi, Mr. Glenn.
I've not fixed this issuer until now. So I attached my code snippet.

I'm simulating power cable on the terrain along time.
Let consider current time as t, past time as t-1, t-2, ..., t-29. So I want to rendering 30 cable shapes according time [t-29, t].
Users can notice cable shape in this time interval via the scene.  
I called below "updateCable()" function every 0.5 sec. Then this function will remove the latest cable and add the new cable on the scene. But sometimes I get the vector crash.
How can I fix it?

void updateCable()
{
        osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform();
        mt->setMatrix(osg::Matrixd::translate(getNewCablePos().x, getNewCablePos().y, getNewCablePos().z));
        mt->addChild(getNewCableGeom());
        _runtimeRoot->addChild(mt);
        if (_runtimeRoot->getNumChildren()> 30)
           _runtimeRoot->removeChild(0, 1);

}
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Debug Assertion Failed!

Are you modifying the scene graph from a legal thread? Like the update traversal?
Glenn Waldron / Pelican Mapping / @glennwaldron
Daven Hem Daven Hem
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Debug Assertion Failed!

This post was updated on .
Mr. Glenn.
Thanks for your quick response.
I don't use multi-thread. After received your reply, I tested my viewer with single thread.

I meant I remove the latest (for latest time) child node and add the new child node so fast.
So I'm adding new cable shape using this update function.
Please hint my code error.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Debug Assertion Failed!

Daven,

Let me ask a different way. Where do you call updateCable? A stack trace would be helpful.
Glenn Waldron / Pelican Mapping / @glennwaldron
Loading...