diff options
author | vaxerski <[email protected]> | 2023-03-19 02:19:52 +0000 |
---|---|---|
committer | vaxerski <[email protected]> | 2023-03-19 02:19:52 +0000 |
commit | 928de3344767b1c8aeade24d57b188aeef57a273 (patch) | |
tree | 6ed63a115513ee9c91985543ed57726adf4808a1 | |
parent | 06244555915339967864292dd0b83cd9732516d8 (diff) | |
download | Hyprland-928de3344767b1c8aeade24d57b188aeef57a273.tar.gz Hyprland-928de3344767b1c8aeade24d57b188aeef57a273.zip |
monitors: more guards for safety
-rw-r--r-- | src/events/Windows.cpp | 6 | ||||
-rw-r--r-- | src/render/OpenGL.cpp | 12 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index be75dfd9..7d3b2412 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -675,8 +675,10 @@ void Events::listener_unmapWindow(void* owner, void* data) { const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); // do the animation thing - PWINDOW->m_vOriginalClosedPos = PWINDOW->m_vRealPosition.vec() - PMONITOR->vecPosition; - PWINDOW->m_vOriginalClosedSize = PWINDOW->m_vRealSize.vec(); + if (PMONITOR) { + PWINDOW->m_vOriginalClosedPos = PWINDOW->m_vRealPosition.vec() - PMONITOR->vecPosition; + PWINDOW->m_vOriginalClosedSize = PWINDOW->m_vRealSize.vec(); + } if (!PWINDOW->m_bX11DoesntWantBorders) // don't animate out if they weren't animated in. PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.vec() + Vector2D(0.01f, 0.01f); // it has to be animated, otherwise onWindowPostCreateClose will ignore it diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 3ae259b5..7628206e 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -1074,6 +1074,10 @@ void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CGradientValueData& grad, void CHyprOpenGLImpl::makeRawWindowSnapshot(CWindow* pWindow, CFramebuffer* pFramebuffer) { // we trust the window is valid. const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); + + if (!PMONITOR || !PMONITOR->output) + return; + wlr_output_attach_render(PMONITOR->output, nullptr); // we need to "damage" the entire monitor @@ -1129,6 +1133,10 @@ void CHyprOpenGLImpl::makeRawWindowSnapshot(CWindow* pWindow, CFramebuffer* pFra void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) { // we trust the window is valid. const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); + + if (!PMONITOR || !PMONITOR->output) + return; + wlr_output_attach_render(PMONITOR->output, nullptr); // we need to "damage" the entire monitor @@ -1189,6 +1197,10 @@ void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) { void CHyprOpenGLImpl::makeLayerSnapshot(SLayerSurface* pLayer) { // we trust the window is valid. const auto PMONITOR = g_pCompositor->getMonitorFromID(pLayer->monitorID); + + if (!PMONITOR || !PMONITOR->output) + return; + wlr_output_attach_render(PMONITOR->output, nullptr); // we need to "damage" the entire monitor |