fix memory leak around chart listeners

Found by Lsan.

The following pattern leaks memory:

boost::ptr_container x;
x.release().release();

Change-Id: Iaf52e4f2d6a96266fc6afd65ef8027d80c97a08b
(cherry picked from commit 42cd7a8a26201fa1db98d6498198db23abef87fc)
Reviewed-on: https://gerrit.libreoffice.org/10741
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>