Menu

#6 DSVL_GraphManager::SampleCB crash

v2.71
open
Other (4)
5
2008-12-18
2008-01-14
dsz31
No

Hi,

I modify all the solutions to compile ARToolkit (tinyxml, dsvl, etc...) with Visual Studio 2005.

And when I try glutSample in DSVL project, then it crashed: "map/set iterator not incrementable".

It is due to a bug in DSVL_GraphManager::SampleCB method:

******************
** Current code **
******************

if(mb.size() > 0) // constantly clean up (mb)
{
std::map<unsigned long, MemoryBufferEntry>::iterator iter;
for(iter = mb.begin();
iter != mb.end();
iter++)
{
if((*iter).second.use_count == 0)
{
(*iter).second.media_sample->Release();
std::map<unsigned long, MemoryBufferEntry>::iterator iter2 =
mb.erase(iter);
iter = iter2;
}
}
}

****************
** Fixed code **
****************
if(mb.size() > 0) // constantly clean up (mb)
{
std::map<unsigned long, MemoryBufferEntry>::iterator iter;
for(iter = mb.begin();
iter != mb.end();
/*iter++*/)
{
if((*iter).second.use_count == 0)
{
(*iter).second.media_sample->Release();
std::map<unsigned long, MemoryBufferEntry>::iterator iter2 =
mb.erase(iter);
iter = iter2;
}
else
iter++;
}
}

**************
**************
The 'iter++' must be done only if the iterator is not removed.

David

Discussion

  • dsz31

    dsz31 - 2008-01-14

    Logged In: YES
    user_id=1980945
    Originator: YES

    Same remark on DSVL_Manager::DisableMemoryBuffer method.

     
  • Hartmut Seichter

    • assigned_to: nobody --> retrakker
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.