java & java/matlab swig client could allow the connection to be GCed while doing an iterate, leading to a segfault.
If a user was to create a connection in a function, start an iteration, and return the connection_iterator we could be in trouble. If the connection was not referred to by anything it could be a GC candidate, thus destroying the connection. The connection_iterator only refers back to the connection via a C++ reference, not a shared_ptr or a java pointer. So there is nothing to force the connection to stay alive.
This was noticed while working on a 'connection-less' iterate in java, which would have forced the problem described.
We seem to have avoided issues on this due to good timing with the GC.
The fix is to have a link back to the connection that is persistent for the duration of the iteration.