Comment 14 for bug 1767826

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

I am trying to understand how to bring the track DLIST to this particular corrupted state (list head == nullptr, count > 0). I suppose this would be a hint informative enough to let us search for particular patterns in the code.

One simple way would be to prepend a nullptr (e.g. board->m_Track.PushFront( nullptr )), but this instantly crashes when DHEAD::insert() tries to set next and previous elements, so no bonus.

Another way would be to add tracks to another DLIST instance and clear it:

  board->m_Track.PushFront( nullptr );
  DLIST<TRACK> tracks;

  for( TRACK* t = board->m_Track; t; t = t->Next() )
      tracks.PushBack( t );

  while( tracks.PopFront() );

The snippet above results in similar symptoms as DLIST::PopFront() resets next/previous pointers for each element, effectively disconnecting them on both list, but the counter value is only maintained for the local 'tracks' variable (IMHO this is bad enough to replace DLIST with an STL container). The only difference is that the original list head still points to a track, which is saved in the file, so it is not exactly the problem we are trying to reproduce.

Any other ideas?