diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2024-04-19 22:16:35 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-19 22:16:35 +0100 |
| commit | b52a49b4c4c344784b3085cb93d3882d3ce9b4bb (patch) | |
| tree | a8c3ab6cf77cec5e22565f0f2a3adacfaa6edf30 /src/protocols/WaylandProtocol.cpp | |
| parent | 1016faea53fd2d6a9bc12340425230b84676d7cd (diff) | |
tearing-control: hyprland impl (#5655)
* tearing: hl impl
* format
Diffstat (limited to 'src/protocols/WaylandProtocol.cpp')
| -rw-r--r-- | src/protocols/WaylandProtocol.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/protocols/WaylandProtocol.cpp b/src/protocols/WaylandProtocol.cpp index 4600126c..76f5eba0 100644 --- a/src/protocols/WaylandProtocol.cpp +++ b/src/protocols/WaylandProtocol.cpp @@ -31,7 +31,14 @@ void CWaylandResource::markDefunct() { Debug::log(TRACE, "[wl res {:x}] now defunct", (uintptr_t)m_pWLResource); m_bDefunct = true; + wl_resource_set_user_data(m_pWLResource, nullptr); + + // we call it here because we need defunct to be set to true. + // if this function destroys us, we can't call wl_resource_set_user_data or + // destroy the resource. + if (m_fOnDestroyHandler) + m_fOnDestroyHandler(this); } CWaylandResource::~CWaylandResource() { @@ -80,6 +87,10 @@ void* CWaylandResource::data() { return m_pData; } +void CWaylandResource::setOnDestroyHandler(std::function<void(CWaylandResource* res)> fn) { + m_fOnDestroyHandler = fn; +} + static void bindManagerInternal(wl_client* client, void* data, uint32_t ver, uint32_t id) { ((IWaylandProtocol*)data)->bindManager(client, data, ver, id); } |
