plugins/backgroundcontrast: Fix a crash
The updateContrastRegion() creates an ItemEffect() object to block direct scanout. However, it doesn't take into account that the surface item can be null when a window is added. It can happen with Xwayland windows. The contrast effect creates an ItemEffect object for the SurfaceItem, which is reasonable. But on the other hand, the contrast effect still operates per window. So this change simply makes the contrast effect register an ItemEffect with the WindowItem. When proper per item effects are supported, this can be changed (the contrast effect would need to monitor the wl_surface getting added and removed).
This commit is contained in:
parent
8f40b5b554
commit
51cb1baf1b
2 changed files with 2 additions and 2 deletions
|
@ -176,7 +176,7 @@ void ContrastEffect::updateContrastRegion(EffectWindow *w)
|
||||||
Data &data = m_windowData[w];
|
Data &data = m_windowData[w];
|
||||||
data.colorMatrix = matrix;
|
data.colorMatrix = matrix;
|
||||||
data.contrastRegion = region;
|
data.contrastRegion = region;
|
||||||
data.surfaceEffect = ItemEffect(w->windowItem()->surfaceItem());
|
data.windowEffect = ItemEffect(w->windowItem());
|
||||||
} else {
|
} else {
|
||||||
if (auto it = m_windowData.find(w); it != m_windowData.end()) {
|
if (auto it = m_windowData.find(w); it != m_windowData.end()) {
|
||||||
effects->makeOpenGLContextCurrent();
|
effects->makeOpenGLContextCurrent();
|
||||||
|
|
|
@ -76,7 +76,7 @@ private:
|
||||||
QRegion contrastRegion;
|
QRegion contrastRegion;
|
||||||
std::unique_ptr<GLTexture> texture;
|
std::unique_ptr<GLTexture> texture;
|
||||||
std::unique_ptr<GLFramebuffer> fbo;
|
std::unique_ptr<GLFramebuffer> fbo;
|
||||||
ItemEffect surfaceEffect;
|
ItemEffect windowEffect;
|
||||||
};
|
};
|
||||||
std::unordered_map<const EffectWindow *, Data> m_windowData;
|
std::unordered_map<const EffectWindow *, Data> m_windowData;
|
||||||
static ContrastManagerInterface *s_contrastManager;
|
static ContrastManagerInterface *s_contrastManager;
|
||||||
|
|
Loading…
Reference in a new issue