diff options
| author | Vaxry <vaxry@vaxry.net> | 2024-02-27 12:23:59 +0000 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2024-02-27 12:23:59 +0000 |
| commit | 21f7f32dc98521025cea76e530204ea64f2630f0 (patch) | |
| tree | b5808db4f81ee0b0d7e0c3299e1847336f2596a4 /src/protocols/Screencopy.cpp | |
| parent | ffd721724392a565d2a45ea0f82d80530129f25a (diff) | |
screencopy: avoid dangling client ptrs on client destroy
Diffstat (limited to 'src/protocols/Screencopy.cpp')
| -rw-r--r-- | src/protocols/Screencopy.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp index 6dc787fb..b2f196f3 100644 --- a/src/protocols/Screencopy.cpp +++ b/src/protocols/Screencopy.cpp @@ -95,6 +95,9 @@ static SScreencopyFrame* frameFromResource(wl_resource* resource) { } void CScreencopyProtocolManager::removeClient(CScreencopyClient* client, bool force) { + if (!client) + return; + if (!force) { if (!client || client->ref <= 0) return; @@ -104,6 +107,12 @@ void CScreencopyProtocolManager::removeClient(CScreencopyClient* client, bool fo } m_lClients.remove(*client); // TODO: this doesn't get cleaned up after sharing app exits??? + + for (auto& f : m_lFrames) { + // avoid dangling ptrs + if (f.client == client) + f.client = nullptr; + } } static void handleManagerResourceDestroy(wl_resource* resource) { |
