mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-07-25 17:21:54 -07:00
render, helpers: Call OpenGL destroyMonitorResources on disconnect (#10111)
* render, helpers: Call OpenGL destroyMonitorResources on disconnect * helpers: Add opengl null check
This commit is contained in:
@@ -51,6 +51,8 @@ CMonitor::CMonitor(SP<Aquamarine::IOutput> output_) : state(this), output(output
|
||||
|
||||
CMonitor::~CMonitor() {
|
||||
events.destroy.emit();
|
||||
if (g_pHyprOpenGL)
|
||||
g_pHyprOpenGL->destroyMonitorResources(self);
|
||||
}
|
||||
|
||||
void CMonitor::onConnect(bool noRule) {
|
||||
@@ -295,6 +297,8 @@ void CMonitor::onDisconnect(bool destroy) {
|
||||
Debug::log(LOG, "onDisconnect called for {}", output->name);
|
||||
|
||||
events.disconnect.emit();
|
||||
if (g_pHyprOpenGL)
|
||||
g_pHyprOpenGL->destroyMonitorResources(self);
|
||||
|
||||
// record what workspace this monitor was on
|
||||
if (activeWorkspace) {
|
||||
@@ -832,7 +836,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
|
||||
updateMatrix();
|
||||
|
||||
if (WAS10B != enabled10bit || OLDRES != vecPixelSize)
|
||||
g_pHyprOpenGL->destroyMonitorResources(self.lock());
|
||||
g_pHyprOpenGL->destroyMonitorResources(self);
|
||||
|
||||
g_pCompositor->arrangeMonitors();
|
||||
|
||||
|
@@ -2997,7 +2997,7 @@ void CHyprOpenGLImpl::clearWithTex() {
|
||||
}
|
||||
}
|
||||
|
||||
void CHyprOpenGLImpl::destroyMonitorResources(PHLMONITOR pMonitor) {
|
||||
void CHyprOpenGLImpl::destroyMonitorResources(PHLMONITORREF pMonitor) {
|
||||
g_pHyprRenderer->makeEGLCurrent();
|
||||
|
||||
if (!g_pHyprOpenGL)
|
||||
@@ -3021,7 +3021,8 @@ void CHyprOpenGLImpl::destroyMonitorResources(PHLMONITOR pMonitor) {
|
||||
g_pHyprOpenGL->m_mMonitorBGFBs.erase(TEXIT);
|
||||
}
|
||||
|
||||
Debug::log(LOG, "Monitor {} -> destroyed all render data", pMonitor->szName);
|
||||
if (pMonitor)
|
||||
Debug::log(LOG, "Monitor {} -> destroyed all render data", pMonitor->szName);
|
||||
}
|
||||
|
||||
void CHyprOpenGLImpl::saveMatrix() {
|
||||
|
@@ -207,7 +207,7 @@ class CHyprOpenGLImpl {
|
||||
void scissor(const pixman_box32*, bool transform = true);
|
||||
void scissor(const int x, const int y, const int w, const int h, bool transform = true);
|
||||
|
||||
void destroyMonitorResources(PHLMONITOR);
|
||||
void destroyMonitorResources(PHLMONITORREF);
|
||||
|
||||
void markBlurDirtyForMonitor(PHLMONITOR);
|
||||
|
||||
|
Reference in New Issue
Block a user