Fix #204: Leak in CustomDialog

Also included test method inside CustomDialogSample