> The proposed solution depends on knowledge of how things work internally (e.g.
> that buffers are allocated lazily). I think that something in the spirit of
> http://paste.ubuntu.com/6998792/ is cleaner (for a more robust solution we
> need to restore the previous context instead of just releasing the current
> one, or alternatively, not bind a new context at all if there is an active
> context already).
Applied your patch - it is sufficient for the example.
> The proposed solution depends on knowledge of how things work internally (e.g. paste.ubuntu. com/6998792/ is cleaner (for a more robust solution we
> that buffers are allocated lazily). I think that something in the spirit of
> http://
> need to restore the previous context instead of just releasing the current
> one, or alternatively, not bind a new context at all if there is an active
> context already).
Applied your patch - it is sufficient for the example.