diff options
author | Tom Englund <[email protected]> | 2024-06-22 00:40:45 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-06-22 00:40:45 +0200 |
commit | fa022901cf2c9acdae9e9a24a68b9148d44f8627 (patch) | |
tree | 5bb971b1d635505ba727eb8dacc6b6e3a9a086d5 | |
parent | 4a8b13ea4f8e5111390471c9212d10d4d032e837 (diff) | |
download | Hyprland-fa022901cf2c9acdae9e9a24a68b9148d44f8627.tar.gz Hyprland-fa022901cf2c9acdae9e9a24a68b9148d44f8627.zip |
surface: add virtual destructor to surfacerole to avoid undefined behaviour (#6620)
* surfacerole: add virtual destructor
all classes that will be derived from should have a virtual destructor
otherwise deleting an instance via pointer to a base class is undefined
behaviour, layershell/xdgshell hits this with std::default_delete in the
new sharedptr implentation.
* includes: fix missing includes
fix missing includes for no precompiled headers builds, and remove a
redefiniton of a macro already defined in macros.hpp
-rw-r--r-- | src/managers/CursorManager.hpp | 1 | ||||
-rw-r--r-- | src/protocols/types/SurfaceRole.hpp | 1 | ||||
-rw-r--r-- | src/xwayland/XSurface.hpp | 1 | ||||
-rw-r--r-- | src/xwayland/XWM.hpp | 1 | ||||
-rw-r--r-- | src/xwayland/XWayland.hpp | 5 |
5 files changed, 6 insertions, 3 deletions
diff --git a/src/managers/CursorManager.hpp b/src/managers/CursorManager.hpp index f983efbb..3ee98ca6 100644 --- a/src/managers/CursorManager.hpp +++ b/src/managers/CursorManager.hpp @@ -5,6 +5,7 @@ #include <memory> #include "../includes.hpp" #include "../helpers/math/Math.hpp" +#include "../helpers/memory/Memory.hpp" struct wlr_buffer; struct wlr_xcursor_manager; diff --git a/src/protocols/types/SurfaceRole.hpp b/src/protocols/types/SurfaceRole.hpp index 05c0ea66..faaf70ee 100644 --- a/src/protocols/types/SurfaceRole.hpp +++ b/src/protocols/types/SurfaceRole.hpp @@ -11,4 +11,5 @@ enum eSurfaceRole { class ISurfaceRole { public: virtual eSurfaceRole role() = 0; + virtual ~ISurfaceRole() = default; }; diff --git a/src/xwayland/XSurface.hpp b/src/xwayland/XSurface.hpp index 4e31e88d..61eee984 100644 --- a/src/xwayland/XSurface.hpp +++ b/src/xwayland/XSurface.hpp @@ -2,6 +2,7 @@ #include "../helpers/WLListener.hpp" #include "../helpers/signal/Signal.hpp" +#include "../helpers/memory/Memory.hpp" #include "../helpers/math/Math.hpp" #include <vector> diff --git a/src/xwayland/XWM.hpp b/src/xwayland/XWM.hpp index 6456c71b..88606416 100644 --- a/src/xwayland/XWM.hpp +++ b/src/xwayland/XWM.hpp @@ -1,6 +1,7 @@ #pragma once #include "../helpers/signal/Signal.hpp" +#include "../helpers/memory/Memory.hpp" #include "../helpers/WLListener.hpp" #include "../macros.hpp" diff --git a/src/xwayland/XWayland.hpp b/src/xwayland/XWayland.hpp index c7981251..d1cc4421 100644 --- a/src/xwayland/XWayland.hpp +++ b/src/xwayland/XWayland.hpp @@ -2,6 +2,7 @@ #include <memory> #include "../helpers/signal/Signal.hpp" +#include "../helpers/memory/Memory.hpp" #include "XSurface.hpp" @@ -29,10 +30,8 @@ class CXWayland { } events; }; -inline std::unique_ptr<CXWayland> g_pXWayland; +inline std::unique_ptr<CXWayland> g_pXWayland; -#define HYPRATOM(name) \ - { name, 0 } inline std::unordered_map<std::string, uint32_t> HYPRATOMS = { HYPRATOM("_NET_SUPPORTED"), HYPRATOM("_NET_SUPPORTING_WM_CHECK"), |