mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 09:45:58 +01:00
internal: various improvements to avoid crashes on exit
This commit is contained in:
parent
13b4c6de86
commit
03c6f4506a
6 changed files with 18 additions and 1 deletions
|
@ -339,7 +339,8 @@ void CCompositor::cleanup() {
|
||||||
|
|
||||||
removeLockFile();
|
removeLockFile();
|
||||||
|
|
||||||
m_bIsShuttingDown = true;
|
m_bIsShuttingDown = true;
|
||||||
|
Debug::shuttingDown = true;
|
||||||
|
|
||||||
#ifdef USES_SYSTEMD
|
#ifdef USES_SYSTEMD
|
||||||
if (sd_booted() > 0)
|
if (sd_booted() > 0)
|
||||||
|
|
|
@ -22,6 +22,9 @@ CWindow::~CWindow() {
|
||||||
g_pCompositor->m_pLastWindow = nullptr;
|
g_pCompositor->m_pLastWindow = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!g_pHyprOpenGL)
|
||||||
|
return;
|
||||||
|
|
||||||
g_pHyprRenderer->makeEGLCurrent();
|
g_pHyprRenderer->makeEGLCurrent();
|
||||||
std::erase_if(g_pHyprOpenGL->m_mWindowFramebuffers, [&](const auto& other) { return other.first == this; });
|
std::erase_if(g_pHyprOpenGL->m_mWindowFramebuffers, [&](const auto& other) { return other.first == this; });
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace Debug {
|
||||||
inline int64_t* disableTime = nullptr;
|
inline int64_t* disableTime = nullptr;
|
||||||
inline bool disableStdout = false;
|
inline bool disableStdout = false;
|
||||||
inline bool trace = false;
|
inline bool trace = false;
|
||||||
|
inline bool shuttingDown = false;
|
||||||
|
|
||||||
inline std::string rollingLog = ""; // rolling log contains the ROLLING_LOG_SIZE tail of the log
|
inline std::string rollingLog = ""; // rolling log contains the ROLLING_LOG_SIZE tail of the log
|
||||||
|
|
||||||
|
@ -36,6 +37,9 @@ namespace Debug {
|
||||||
if (level == TRACE && !trace)
|
if (level == TRACE && !trace)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (shuttingDown)
|
||||||
|
return;
|
||||||
|
|
||||||
std::string logMsg = "";
|
std::string logMsg = "";
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
|
|
|
@ -9,6 +9,9 @@ SLayerSurface::SLayerSurface() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SLayerSurface::~SLayerSurface() {
|
SLayerSurface::~SLayerSurface() {
|
||||||
|
if (!g_pHyprOpenGL)
|
||||||
|
return;
|
||||||
|
|
||||||
g_pHyprRenderer->makeEGLCurrent();
|
g_pHyprRenderer->makeEGLCurrent();
|
||||||
std::erase_if(g_pHyprOpenGL->m_mLayerFramebuffers, [&](const auto& other) { return other.first == this; });
|
std::erase_if(g_pHyprOpenGL->m_mLayerFramebuffers, [&](const auto& other) { return other.first == this; });
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
CRenderbuffer::~CRenderbuffer() {
|
CRenderbuffer::~CRenderbuffer() {
|
||||||
|
if (!g_pCompositor)
|
||||||
|
return;
|
||||||
|
|
||||||
if (eglGetCurrentContext() != wlr_egl_get_context(g_pCompositor->m_sWLREGL))
|
if (eglGetCurrentContext() != wlr_egl_get_context(g_pCompositor->m_sWLREGL))
|
||||||
eglMakeCurrent(wlr_egl_get_display(g_pCompositor->m_sWLREGL), EGL_NO_SURFACE, EGL_NO_SURFACE, wlr_egl_get_context(g_pCompositor->m_sWLREGL));
|
eglMakeCurrent(wlr_egl_get_display(g_pCompositor->m_sWLREGL), EGL_NO_SURFACE, EGL_NO_SURFACE, wlr_egl_get_context(g_pCompositor->m_sWLREGL));
|
||||||
|
|
||||||
|
|
|
@ -2281,6 +2281,9 @@ CRenderbuffer* CHyprRenderer::getOrCreateRenderbuffer(wlr_buffer* buffer, uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::makeEGLCurrent() {
|
void CHyprRenderer::makeEGLCurrent() {
|
||||||
|
if (!g_pCompositor)
|
||||||
|
return;
|
||||||
|
|
||||||
if (eglGetCurrentContext() != wlr_egl_get_context(g_pCompositor->m_sWLREGL))
|
if (eglGetCurrentContext() != wlr_egl_get_context(g_pCompositor->m_sWLREGL))
|
||||||
eglMakeCurrent(wlr_egl_get_display(g_pCompositor->m_sWLREGL), EGL_NO_SURFACE, EGL_NO_SURFACE, wlr_egl_get_context(g_pCompositor->m_sWLREGL));
|
eglMakeCurrent(wlr_egl_get_display(g_pCompositor->m_sWLREGL), EGL_NO_SURFACE, EGL_NO_SURFACE, wlr_egl_get_context(g_pCompositor->m_sWLREGL));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue