Fixed memory leak of the gradient view

This is related to Issue #6