screencopy: fix passing of sessions and requests to close handlers

This commit is contained in:
vaxerski 2023-08-30 20:51:45 +02:00
parent 2c8eb43704
commit ee577b571c

View file

@ -281,6 +281,8 @@ static const hyprland_toplevel_export_frame_v1_listener hyprlandFrameListener =
// --------------------------------------------------------- // // --------------------------------------------------------- //
void onCloseRequest(sdbus::MethodCall& call, CScreencopyPortal::SSession* sess) { void onCloseRequest(sdbus::MethodCall& call, CScreencopyPortal::SSession* sess) {
Debug::log(TRACE, "[screencopy] Close Request {}", (void*)sess);
if (!sess || !sess->request) if (!sess || !sess->request)
return; return;
@ -291,6 +293,8 @@ void onCloseRequest(sdbus::MethodCall& call, CScreencopyPortal::SSession* sess)
} }
void onCloseSession(sdbus::MethodCall& call, CScreencopyPortal::SSession* sess) { void onCloseSession(sdbus::MethodCall& call, CScreencopyPortal::SSession* sess) {
Debug::log(TRACE, "[screencopy] Close Session {}", (void*)sess);
if (!sess || !sess->session) if (!sess || !sess->session)
return; return;
@ -320,8 +324,8 @@ void CScreencopyPortal::onCreateSession(sdbus::MethodCall& call) {
PSESSION->request = sdbus::createObject(*g_pPortalManager->getConnection(), requestHandle); PSESSION->request = sdbus::createObject(*g_pPortalManager->getConnection(), requestHandle);
PSESSION->session = sdbus::createObject(*g_pPortalManager->getConnection(), sessionHandle); PSESSION->session = sdbus::createObject(*g_pPortalManager->getConnection(), sessionHandle);
PSESSION->request->registerMethod("org.freedesktop.impl.portal.Request", "Close", "", "", [&](sdbus::MethodCall c) { onCloseRequest(c, PSESSION); }); PSESSION->request->registerMethod("org.freedesktop.impl.portal.Request", "Close", "", "", [PSESSION](sdbus::MethodCall c) { onCloseRequest(c, PSESSION); });
PSESSION->session->registerMethod("org.freedesktop.impl.portal.Session", "Close", "", "", [&](sdbus::MethodCall c) { onCloseSession(c, PSESSION); }); PSESSION->session->registerMethod("org.freedesktop.impl.portal.Session", "Close", "", "", [PSESSION](sdbus::MethodCall c) { onCloseSession(c, PSESSION); });
PSESSION->request->finishRegistration(); PSESSION->request->finishRegistration();
PSESSION->session->finishRegistration(); PSESSION->session->finishRegistration();