From f662f45e86d91ed92cbd19249468da603d53ad31 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Sun, 22 Mar 2020 19:48:51 +0800 Subject: [PATCH] no need to free surface explicitly --- src/gui/menu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/menu.c b/src/gui/menu.c index a42f3c17..f76c2ad4 100644 --- a/src/gui/menu.c +++ b/src/gui/menu.c @@ -2203,14 +2203,15 @@ static int create_memdc_for_menu (TRACKMENUINFO* ptmi) static void delete_memdc_for_menu (TRACKMENUINFO* ptmi) { if (ptmi->dc != HDC_INVALID) { - GAL_Surface *surf = GetSurfaceFromDC (ptmi->dc); - - DeleteMemDC (ptmi->dc); - ptmi->dc = HDC_INVALID; +#if 0 /* deprecated code: we always do refcount++ for any memdc */ /* we must free the surface here, or it can not be freed actually due to the referenced count. */ + GAL_Surface *surf = GetSurfaceFromDC (ptmi->dc); GAL_FreeSurface (surf); +#endif /* deprecated code */ + DeleteMemDC (ptmi->dc); + ptmi->dc = HDC_INVALID; } }