From 4346b9a8bc0d2727d90c435ecfb651d5858e2af1 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Mon, 8 Jan 2024 11:31:33 -0700 Subject: [PATCH] Remove unnecessary default destructor sf::RenderWindow still inherits a virtual destructor from a base class so there's no need to explicitly declare a virtual destructor. I added a test to ensure this property was not broken. --- include/SFML/Graphics/RenderWindow.hpp | 8 -------- src/SFML/Graphics/RenderWindow.cpp | 4 ---- test/Graphics/RenderWindow.test.cpp | 1 + 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/include/SFML/Graphics/RenderWindow.hpp b/include/SFML/Graphics/RenderWindow.hpp index 7b878467f..7495b47a2 100644 --- a/include/SFML/Graphics/RenderWindow.hpp +++ b/include/SFML/Graphics/RenderWindow.hpp @@ -96,14 +96,6 @@ public: //////////////////////////////////////////////////////////// explicit RenderWindow(WindowHandle handle, const ContextSettings& settings = ContextSettings()); - //////////////////////////////////////////////////////////// - /// \brief Destructor - /// - /// Closes the window and frees all the resources attached to it. - /// - //////////////////////////////////////////////////////////// - ~RenderWindow() override; - //////////////////////////////////////////////////////////// /// \brief Get the size of the rendering region of the window /// diff --git a/src/SFML/Graphics/RenderWindow.cpp b/src/SFML/Graphics/RenderWindow.cpp index acbdb56c3..2b232d824 100644 --- a/src/SFML/Graphics/RenderWindow.cpp +++ b/src/SFML/Graphics/RenderWindow.cpp @@ -52,10 +52,6 @@ RenderWindow::RenderWindow(WindowHandle handle, const ContextSettings& settings) } -//////////////////////////////////////////////////////////// -RenderWindow::~RenderWindow() = default; - - //////////////////////////////////////////////////////////// Vector2u RenderWindow::getSize() const { diff --git a/test/Graphics/RenderWindow.test.cpp b/test/Graphics/RenderWindow.test.cpp index 5d76f626a..d502761a1 100644 --- a/test/Graphics/RenderWindow.test.cpp +++ b/test/Graphics/RenderWindow.test.cpp @@ -17,6 +17,7 @@ TEST_CASE("[Graphics] sf::RenderWindow", runDisplayTests()) { SECTION("Type traits") { + STATIC_CHECK(std::has_virtual_destructor_v); STATIC_CHECK(!std::is_copy_constructible_v); STATIC_CHECK(!std::is_copy_assignable_v); STATIC_CHECK(!std::is_nothrow_move_constructible_v);