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
This commit is contained in:
Tom Englund 2024-06-22 00:40:45 +02:00 committed by GitHub
parent 4a8b13ea4f
commit fa022901cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 3 deletions

View File

@ -5,6 +5,7 @@
#include <memory> #include <memory>
#include "../includes.hpp" #include "../includes.hpp"
#include "../helpers/math/Math.hpp" #include "../helpers/math/Math.hpp"
#include "../helpers/memory/Memory.hpp"
struct wlr_buffer; struct wlr_buffer;
struct wlr_xcursor_manager; struct wlr_xcursor_manager;

View File

@ -11,4 +11,5 @@ enum eSurfaceRole {
class ISurfaceRole { class ISurfaceRole {
public: public:
virtual eSurfaceRole role() = 0; virtual eSurfaceRole role() = 0;
virtual ~ISurfaceRole() = default;
}; };

View File

@ -2,6 +2,7 @@
#include "../helpers/WLListener.hpp" #include "../helpers/WLListener.hpp"
#include "../helpers/signal/Signal.hpp" #include "../helpers/signal/Signal.hpp"
#include "../helpers/memory/Memory.hpp"
#include "../helpers/math/Math.hpp" #include "../helpers/math/Math.hpp"
#include <vector> #include <vector>

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "../helpers/signal/Signal.hpp" #include "../helpers/signal/Signal.hpp"
#include "../helpers/memory/Memory.hpp"
#include "../helpers/WLListener.hpp" #include "../helpers/WLListener.hpp"
#include "../macros.hpp" #include "../macros.hpp"

View File

@ -2,6 +2,7 @@
#include <memory> #include <memory>
#include "../helpers/signal/Signal.hpp" #include "../helpers/signal/Signal.hpp"
#include "../helpers/memory/Memory.hpp"
#include "XSurface.hpp" #include "XSurface.hpp"
@ -29,10 +30,8 @@ class CXWayland {
} events; } 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 = { inline std::unordered_map<std::string, uint32_t> HYPRATOMS = {
HYPRATOM("_NET_SUPPORTED"), HYPRATOM("_NET_SUPPORTED"),
HYPRATOM("_NET_SUPPORTING_WM_CHECK"), HYPRATOM("_NET_SUPPORTING_WM_CHECK"),