summaryrefslogtreecommitdiff
path: root/src/protocols/WaylandProtocol.cpp
diff options
context:
space:
mode:
authorLee Bousfield <ljbousfield@gmail.com>2025-02-27 19:52:31 -0600
committerGitHub <noreply@github.com>2025-02-28 02:52:31 +0100
commit445337d03dce7c9aef10ff4d57fc516ac8c1b24d (patch)
treeacf172dc558e0cd8c67dcc72d32c815edfc608c3 /src/protocols/WaylandProtocol.cpp
parent34f2a4713e6835df68156b7d21b11321b276821c (diff)
protocols: Fix IWaylandProtocol onDisplayDestroy m_pGlobal double-free (#9507)
Diffstat (limited to 'src/protocols/WaylandProtocol.cpp')
-rw-r--r--src/protocols/WaylandProtocol.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/protocols/WaylandProtocol.cpp b/src/protocols/WaylandProtocol.cpp
index 7fef5179..48bd6d2a 100644
--- a/src/protocols/WaylandProtocol.cpp
+++ b/src/protocols/WaylandProtocol.cpp
@@ -14,7 +14,10 @@ static void displayDestroyInternal(struct wl_listener* listener, void* data) {
void IWaylandProtocol::onDisplayDestroy() {
wl_list_remove(&m_liDisplayDestroy.listener.link);
wl_list_init(&m_liDisplayDestroy.listener.link);
- wl_global_destroy(m_pGlobal);
+ if (m_pGlobal) {
+ wl_global_destroy(m_pGlobal);
+ m_pGlobal = nullptr;
+ }
}
IWaylandProtocol::IWaylandProtocol(const wl_interface* iface, const int& ver, const std::string& name) :
@@ -38,7 +41,8 @@ IWaylandProtocol::~IWaylandProtocol() {
}
void IWaylandProtocol::removeGlobal() {
- wl_global_remove(m_pGlobal);
+ if (m_pGlobal)
+ wl_global_remove(m_pGlobal);
}
wl_global* IWaylandProtocol::getGlobal() {