frequent crash


I am playing around with shaders and I frequently get a crash in xutility

with following callstack

>	libpanda_d.dll!std::_Iterator_base::_Orphan_me()  Line 185 + 0x3 bytes	C++
 	libpanda_d.dll!std::_Iterator_base::~_Iterator_base()  Line 162	C++
 	libpanda_d.dll!std::_Iterator_with_base<std::random_access_iterator_tag,CollisionLevelState<DoubleBitMask<DoubleBitMask<BitMask<unsigned int,32> > > >,int,CollisionLevelState<DoubleBitMask<DoubleBitMask<BitMask<unsigned int,32> > > > const *,CollisionLevelState<DoubleBitMask<DoubleBitMask<BitMask<unsigned int,32> > > > const &,std::_Iterator_base>::~_Iterator_with_base<std::random_access_iterator_tag,CollisionLevelState<DoubleBitMask<DoubleBitMask<BitMask<unsigned int,32> > > >,int,CollisionLevelState<DoubleBitMask<DoubleBitMask<BitMask<unsigned int,32> > > > const *,CollisionLevelState<DoubleBitMask<DoubleBitMask<BitMask<unsigned int,32> > > > const &,std::_Iterator_base>()  + 0x43 bytes	C++
 	libpanda_d.dll!std::_Ranit<LVecBase2d,int,LVecBase2d const *,LVecBase2d const &>::~_Ranit<LVecBase2d,int,LVecBase2d const *,LVecBase2d const &>()  + 0x43 bytes	C++
 	libpanda_d.dll!std::_Vector_const_iterator<Triangulator::trap_t,pallocator_array<Triangulator::trap_t> >::~_Vector_const_iterator<Triangulator::trap_t,pallocator_array<Triangulator::trap_t> >()  + 0x43 bytes	C++
 	libpanda_d.dll!ClipPlaneAttrib::get_hash_impl()  Line 738 + 0x40 bytes	C++
 	libpanda_d.dll!RenderAttrib::get_hash()  Line 99 + 0xf bytes	C++
 	libpanda_d.dll!indirect_method_hash<RenderAttrib const *,indirect_compare_to<RenderAttrib const *> >::operator()(const RenderAttrib * const & key=0x07776fdc)  Line 236	C++
 	libpanda_d.dll!SimpleHashMap<RenderAttrib const *,RenderAttrib::Empty,indirect_compare_to_hash<RenderAttrib const *> >::get_hash(const RenderAttrib * const & key=0x07776fdc)  Line 514 + 0xf bytes	C++
 	libpanda_d.dll!SimpleHashMap<RenderAttrib const *,RenderAttrib::Empty,indirect_compare_to_hash<RenderAttrib const *> >::validate()  Line 469 + 0x14 bytes	C++
 	libpanda_d.dll!SimpleHashMap<RenderAttrib const *,RenderAttrib::Empty,indirect_compare_to_hash<RenderAttrib const *> >::store(const RenderAttrib * const & key=0x07f504d4, const RenderAttrib::Empty & data={...})  Line 167 + 0x8 bytes	C++
 	libpanda_d.dll!RenderAttrib::return_unique(RenderAttrib * attrib=0x07f504d4)  Line 453 + 0x18 bytes	C++
 	libpanda_d.dll!RenderAttrib::return_new(RenderAttrib * attrib=0x07f504d4)  Line 397 + 0xd bytes	C++
 	libpanda_d.dll!ShaderAttrib::set_shader_input(const ShaderInput * input=0x0786ac24)  Line 221 + 0xd bytes	C++
 	libpanda_d.dll!NodePath::set_shader_input(const ShaderInput * inp=0x0786ac24)  Line 3891 + 0x12 bytes	C++
 	libpanda_d.dll!NodePath::set_shader_input(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & id="FlowMapOffset0", double n1=0.015309168025851250, double n2=0.00000000000000000, double n3=0.00000000000000000, double n4=1.0000000000000000, int priority=0)  Line 4254 + 0xd9 bytes	C++
 	FlowingOcean.exe!UpdateWaterFlowParameters()  Line 406 + 0x5b bytes	C++
 	FlowingOcean.exe!RenderWater()  Line 333	C++
 	FlowingOcean.exe!RenderTask(GenericAsyncTask * pTask=0x043464c8, void * data=0x00000000)  Line 358	C++
 	libpanda_d.dll!GenericAsyncTask::do_task()  Line 76 + 0x1b bytes	C++
 	libpanda_d.dll!AsyncTask::unlock_and_do_task()  Line 455 + 0xf bytes	C++
 	libpanda_d.dll!AsyncTaskChain::service_one_task(AsyncTaskChain::AsyncTaskChainThread * thread=0x00000000)  Line 770 + 0xf bytes	C++
 	libpanda_d.dll!AsyncTaskChain::do_poll()  Line 1306	C++
 	libpanda_d.dll!AsyncTaskManager::poll()  Line 547	C++
 	libp3framework_d.dll!PandaFramework::do_frame(Thread * current_thread=0x00a0a4a4)  Line 844 + 0xe bytes	C++
 	FlowingOcean.exe!main(int argc=1, char * * argv=0x00aa7d00)  Line 103 + 0x14 bytes	C++
 	FlowingOcean.exe!__tmainCRTStartup()  Line 586 + 0x19 bytes	C
 	FlowingOcean.exe!mainCRTStartup()  Line 403	C
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	

does that ring a bell with any of the developers?
need more info ?


I suspect you have some corrupt memory somewhere, perhaps because you have incorrectly managed reference counts–by explicitly deleting a PT(Something) object, for instance, or by storing it in a Something* pointer instead of a PT(Something) pointer, or something along those lines.


hi drwr,

this crash when it happens it always happens at a random point during the execution of my program. I am not deleting or creating stuff during execution (only on initialisation). The crash usually happens after I move around my camera.

Is there anything i should keep an eye open next time the crash happens ?

The crash is only the symptom of something that was corrupted earlier. By the time the crash occurs, it is too late to figure out what went wrong.

This is one of the difficulties about C++ development–it’s easy to accidentally corrupt memory by doing something wrong, but it’s hard to detect this kind of corruption at the time it happens. Instead, the system is destabilized and will crash at some future time, which makes debugging difficult.

I don’t have any specific advice, other than perhaps to compile a full-debug version of Panda3D and using that to do all of your development. The additional assertion checks may make it easier to find mistakes sooner.