From 09d2e35372a6d1edc29f769a894b6584dc1d6f2c Mon Sep 17 00:00:00 2001 From: nick black Date: Thu, 30 Jan 2020 04:29:57 -0500 Subject: [PATCH] C++ wrappers: kill Visual::destroy_plane() #299 ncvisual_destroy() already calls ncplane_destroy() when appropriate. There's never a need for the C++ wrappers to explicitly free the Visual's underlying Plane. With this change, valgrind no longer complains upon exiting notcurses-view(1). --- include/ncpp/Visual.hh | 4 ---- src/libcpp/Visual.cc | 5 ----- 2 files changed, 9 deletions(-) diff --git a/include/ncpp/Visual.hh b/include/ncpp/Visual.hh index 89d7329ab..2ee6f4ce4 100644 --- a/include/ncpp/Visual.hh +++ b/include/ncpp/Visual.hh @@ -36,7 +36,6 @@ namespace ncpp ~Visual () noexcept { - destroy_plane (get_plane ()); if (!is_notcurses_stopped ()) ncvisual_destroy (visual); } @@ -73,9 +72,6 @@ namespace ncpp Plane* get_plane () const noexcept; - private: - static void destroy_plane (Plane *plane) noexcept; - private: ncvisual *visual = nullptr; }; diff --git a/src/libcpp/Visual.cc b/src/libcpp/Visual.cc index 8d7281412..cf8701ab9 100644 --- a/src/libcpp/Visual.cc +++ b/src/libcpp/Visual.cc @@ -7,8 +7,3 @@ Plane* Visual::get_plane () const noexcept { return Plane::map_plane (ncvisual_plane (visual)); } - -void Visual::destroy_plane (Plane *plane) noexcept -{ - delete plane; -}