mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-12 10:35:46 -07:00
core: add a destructor to CHyprOpenglImpl and avoid wl_container_of undefined behaviour (#7101)
* protocols: avoid undefined behaviour in C macro to safely use wl_container_of with a class the class has to be no virtual functions, no inheritance, and uniform access control (e.g all public) work around this by putting this into a destroywrapper struct. * opengl: clean memory on destruction add a destructor and free the allocated memory and close the fd
This commit is contained in:
@@ -14,6 +14,12 @@ struct SShortcutClient {
|
||||
std::vector<std::unique_ptr<SShortcut>> shortcuts;
|
||||
};
|
||||
|
||||
class CGlobalShortcutsProtocolManager;
|
||||
struct CGlobalShortcutsProtocolManagerDestroyWrapper {
|
||||
wl_listener listener;
|
||||
CGlobalShortcutsProtocolManager* parent = nullptr;
|
||||
};
|
||||
|
||||
class CGlobalShortcutsProtocolManager {
|
||||
public:
|
||||
CGlobalShortcutsProtocolManager();
|
||||
@@ -31,7 +37,7 @@ class CGlobalShortcutsProtocolManager {
|
||||
|
||||
std::vector<SShortcut> getAllShortcuts();
|
||||
|
||||
wl_listener m_liDisplayDestroy;
|
||||
CGlobalShortcutsProtocolManagerDestroyWrapper m_liDisplayDestroy;
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<SShortcutClient>> m_vClients;
|
||||
|
Reference in New Issue
Block a user