Skip to content

Scene windowPixmap: avoid crashing when current and previousPixmap are null

Méven Car requested to merge work/prevent-crash-quad into Plasma/5.19

Prevents crash:

Thread 1 "kwin_wayland" received signal SIGSEGV, Segmentation fault.
KWin::Scene::Window::makeContentsQuads (this=this@entry=0x55c997c37040)
    at /home/meven/kde/src/kwin/scene.cpp:1008
1008        WindowPixmap *currentPixmap = windowPixmap<WindowPixmap>();
(gdb) bt
#0  0x00007f74f3e5b2c0 in KWin::Scene::Window::makeContentsQuads() const (this=this@entry=0x55c997c37040)
    at /home/meven/kde/src/kwin/scene.cpp:1008
#1  0x00007f74f3e5bae0 in KWin::Scene::Window::buildQuads(bool) const (this=0x55c997c37040, force=<optimized out>) at /home/meven/kde/src/kwin/scene.cpp:903
#2  0x00007f74f3dd2c05 in KWin::EffectWindowImpl::buildQuads(bool) const (this=<optimized out>, force=<optimized out>) at /home/meven/kde/src/kwin/effects.cpp:2034
#3  0x00007f74f38857ca in KWin::WindowPaintData::WindowPaintData(KWin::EffectWindow*, QMatrix4x4 const&) (this=0x7fffc4a08d90, w=0x55c997c440d0, screenProjectionMatrix=...)
    at /home/meven/kde/src/kwin/libkwineffects/kwineffects.cpp:238
#4  0x00007f74f3e5c42b in KWin::Scene::paintWindowThumbnails(KWin::Scene::Window*, QRegion const&, double, double, double) (this=this@entry=0x55c997721740, w=w@entry=0x55c997e70010, region=..., opacity=0.149526761497215, brightness=brightness@entry=1, saturation=saturation@entry=1)
    at /home/meven/kde/src/kwin/scene.cpp:542
#5  0x00007f74f3e5ca23 in KWin::Scene::paintWindow(KWin::Scene::Window*, int, QRegion const&, KWin::WindowQuadList const&) (this=0x55c997721740, w=0x55c997e70010, mask=14, _region=..., quads=...)
    at /home/meven/kde/src/kwin/scene.cpp:501
#6  0x00007f74f3e597d5 in KWin::Scene::paintSimpleScreen(int, QRegion const&) (this=<optimized out>, orig_mask=8, region=...) at /home/meven/kde/src/kwin/scene.cpp:375
#7  0x00007f74f3dcfa8e in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) (this=0x55c997bf2ea0, mask=<optimized out>, region=..., data=...)
    at /home/meven/kde/src/kwin/effects.cpp:400
#8  0x00007f74f3dcfa8e in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) (this=0x55c997bf2ea0, mask=<optimized out>, region=..., data=...)
    at /home/meven/kde/src/kwin/effects.cpp:400
#9  0x00007f74f3dcfa8e in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) (this=0x55c997bf2ea0, mask=<optimized out>, region=..., data=...)
    at /home/meven/kde/src/kwin/effects.cpp:400
#10 0x00007f74f3dcfa8e in KWin::EffectsHandlerImpl::paintScreen(int, QRegion const&, KWin::ScreenPaintData&) (this=0x55c997bf2ea0, mask=<optimized out>, region=..., data=...)
    at /home/meven/kde/src/kwin/effects.cpp:400
#11 0x00007f74f3e5bcea in KWin::Scene::paintScreen(int*, QRegion const&, QRegion const&, QRegion*, QRegion*, QMatrix4x4 const&, QRect const&, double) (this=this@entry=0x55c997721740, mask=mask@entry=0x7fffc4a0920c, damage=..., repaint=..., updateRegion=updateRegion@entry=0x7fffc4a09220, validRegion=validRegion@entry=0x7fffc4a09228, projection=..., outputGeometry=..., screenScale=screenScale@entry=1)
    at /home/meven/kde/src/kwin/scene.cpp:150
#12 0x00007f74d6792b44 in KWin::SceneOpenGL::paint(QRegion const&, QList<KWin::Toplevel*> const&) (this=0x55c997721740, damage=..., toplevels=...)
    at /home/meven/kde/src/kwin/plugins/scenes/opengl/scene_opengl.cpp:653
#13 0x00007f74f3d9bb4e in KWin::Compositor::performCompositing() (this=0x55c997712120)
    at /home/meven/kde/src/kwin/composite.cpp:701
#14 0x00007f74dc040854 in drmHandleEvent () at /usr/lib/x86_64-linux-gnu/libdrm.so.2
#15 0x00007f74d7dcc3f1 in KWin::DrmBackend::<lambda()>::operator() (__closure=<optimized out>)
    at /home/meven/kde/src/kwin/plugins/platforms/drm/drm_backend.cpp:279
#16 0x00007f74d7dcc3f1 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, KWin::DrmBackend::openDrm()::<lambda()> >::call (arg=<optimized out>, f=...)
    at /home/meven/kde/qt5/include/QtCore/qobjectdefs_impl.h:146
#17 0x00007f74d7dcc3f1 in QtPrivate::Functor<KWin::DrmBackend::openDrm()::<lambda()>, 0>::call<QtPrivate::List<>, void> (arg=<optimized out>, f=...) at /home/meven/kde/qt5/include/QtCore/qobjectdefs_impl.h:256
#18 0x00007f74d7dcc3f1 in QtPrivate::QFunctorSlotObject<KWin::DrmBackend::openDrm()::<lambda()>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=<optimized out>, this_=<optimized out>, r=<optimized out>, a=<optimized out>, ret=<optimized out>)
    at /home/meven/kde/qt5/include/QtCore/qobjectdefs_impl.h:443
#19 0x00007f74f12ad0d7 in  () at /home/meven/kde/qt5/lib/libQt5Core.so.5
#20 0x00007f74f12b06b8 in QSocketNotifier::activated(int, QSocketNotifier::QPrivateS
  • @note This method can return @c NULL as there might neither be a valid previous nor current WindowPixmap

Make the implementation follow the documentation.

@vladz @davidedmundson

Edited by Méven Car

Merge request reports