Fixes issue #129 - Don't leak gcodes in block.
authorAdam Green <adamgr@foo.bar>
Thu, 21 Feb 2013 22:58:45 +0000 (14:58 -0800)
committerAdam Green <adamgr@foo.bar>
Thu, 21 Feb 2013 22:58:45 +0000 (14:58 -0800)
commit6476be0a7d402ebc7f38b506b0c38c1ad44970f3
tree0d3bfd832a31565e8f87ea37e2b6655252948fc5
parent1547904b69dbdbc146f11c1edb15729c8f0c9edf
Fixes issue #129 - Don't leak gcodes in block.

Previously Conveyor::new_block() was never executing the last chance
code it contained to clean up the next block that it was going to
overwrite and use in the ring buffer.  This was failing to run becaues
this->queue.get_ref(this->queue.size()) would always return a NULL
pointer as that method doesn't allow indexing to or past the tail.

I added a get_tail_ref() method to RingBuffer which returns the
required pointer.

NOTE: There is still a bug in the flush_blocks / Conveyor::on_idle()
      code path as it should have cleaned up this block already but it
      failed to do so.
src/libs/RingBuffer.h
src/modules/robot/Conveyor.cpp