mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-05 20:58:02 +02:00
screencopy: fix crash in screensharing toplevel with invalid handle (#13781)
This commit is contained in:
parent
3b902a47fe
commit
b940b0d2c1
2 changed files with 14 additions and 0 deletions
|
|
@ -9,10 +9,16 @@
|
|||
using namespace Screenshare;
|
||||
|
||||
CScreenshareSession::CScreenshareSession(PHLMONITOR monitor, wl_client* client) : m_type(SHARE_MONITOR), m_monitor(monitor), m_client(client) {
|
||||
if UNLIKELY (!m_monitor)
|
||||
return;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
CScreenshareSession::CScreenshareSession(PHLWINDOW window, wl_client* client) : m_type(SHARE_WINDOW), m_window(window), m_client(client) {
|
||||
if UNLIKELY (!m_window)
|
||||
return;
|
||||
|
||||
m_listeners.windowDestroyed = m_window->m_events.unmap.listen([this]() { stop(); });
|
||||
m_listeners.windowSizeChanged = m_window->m_events.resize.listen([this]() {
|
||||
calculateConstraints();
|
||||
|
|
@ -34,6 +40,9 @@ CScreenshareSession::CScreenshareSession(PHLWINDOW window, wl_client* client) :
|
|||
|
||||
CScreenshareSession::CScreenshareSession(PHLMONITOR monitor, CBox captureRegion, wl_client* client) :
|
||||
m_type(SHARE_REGION), m_monitor(monitor), m_captureBox(captureRegion), m_client(client) {
|
||||
if UNLIKELY (!m_monitor)
|
||||
return;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,11 @@ CToplevelExportClient::CToplevelExportClient(SP<CHyprlandToplevelExportManagerV1
|
|||
}
|
||||
|
||||
void CToplevelExportClient::captureToplevel(uint32_t frame, int32_t overlayCursor_, PHLWINDOW handle) {
|
||||
if UNLIKELY (!handle) {
|
||||
LOGM(Log::ERR, "Couldn't capture (window doesn't exist)");
|
||||
return;
|
||||
}
|
||||
|
||||
auto session = Screenshare::mgr()->getManagedSession(m_resource->client(), handle);
|
||||
|
||||
// create a frame
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue