fixes #4305 GUI Samples memory leak.