Bug 365471 - KWin crashes when switching rendering backend with QPainter scene
Summary: KWin crashes when switching rendering backend with QPainter scene
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR minor
Target Milestone: ---
Assignee: KWin default assignee
URL: https://phabricator.kde.org/D2185
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-12 15:26 UTC by Fabian Vogt
Modified: 2016-07-21 06:20 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 5.7.3
mgraesslin: ReviewRequest+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Vogt 2016-07-12 15:26:58 UTC
In a VM with virtio graphics, KWIN_COMPOSE=Q kwin_wayland [...] crashes when the rendering backend is changed.
The actual backend doesn't seem to matter.

264             Window* w = stacking_order[ i ];                                                                                                                                                                                              
265             Toplevel* topw = w->window() <-- w is nullptr
266             WindowPrePaintData data;

Backtrace:

#0  0x00007fcf7c4600f2 in KWin::Scene::paintSimpleScreen (this=this@entry=0x151f460, orig_mask=orig_mask@entry=0, region=...) at /usr/src/debug/kwin-5.6.90git~20160704T143735~2b5747d/scene.cpp:264
#1  0x00007fcf7c460f24 in KWin::Scene::finalPaintScreen (this=0x151f460, mask=mask@entry=0, region=..., data=...) at /usr/src/debug/kwin-5.6.90git~20160704T143735~2b5747d/scene.cpp:201
#2  0x00007fcf7c489b3f in KWin::EffectsHandlerImpl::paintScreen (this=0x15d0fe0, mask=0, region=..., data=...) at /usr/src/debug/kwin-5.6.90git~20160704T143735~2b5747d/effects.cpp:429
#3  0x00007fcf7c460bad in KWin::Scene::paintScreen (this=this@entry=0x151f460, mask=mask@entry=0x7fffc220eeac, damage=..., repaint=..., updateRegion=updateRegion@entry=0x7fffc220eec0, validRegion=validRegion@entry=0x7fffc220eed0, 
    projection=...) at /usr/src/debug/kwin-5.6.90git~20160704T143735~2b5747d/scene.cpp:151
#4  0x00007fcf7c480e77 in KWin::SceneQPainter::paint (this=0x151f460, damage=..., toplevels=...) at /usr/src/debug/kwin-5.6.90git~20160704T143735~2b5747d/scene_qpainter.cpp:159
#5  0x00007fcf7c45399a in KWin::Compositor::performCompositing (this=this@entry=0x12e3140) at /usr/src/debug/kwin-5.6.90git~20160704T143735~2b5747d/composite.cpp:713
#6  0x00007fcf7c454039 in KWin::Compositor::startupWithWorkspace (this=0x12e3140) at /usr/src/debug/kwin-5.6.90git~20160704T143735~2b5747d/composite.cpp:334
#7  0x00007fcf7c4549e3 in KWin::Compositor::slotCompositingOptionsInitialized (this=this@entry=0x12e3140) at /usr/src/debug/kwin-5.6.90git~20160704T143735~2b5747d/composite.cpp:269
#8  0x00007fcf7c454f12 in KWin::Compositor::setup (this=0x12e3140) at /usr/src/debug/kwin-5.6.90git~20160704T143735~2b5747d/composite.cpp:180
#9  0x00007fcf7c45627c in KWin::Compositor::slotReinitialize (this=0x12e3140) at /usr/src/debug/kwin-5.6.90git~20160704T143735~2b5747d/composite.cpp:479
#10 0x00007fcf7c525b15 in KWin::Compositor::qt_metacall (this=0x12e3140, _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0x7fffc220f3c0) at /usr/src/debug/kwin-5.6.90git~20160704T143735~2b5747d/build/kwin_automoc.dir/moc_composite.cpp:332
#11 0x00007fcf7395ec90 in ?? () from /usr/lib64/libQt5DBus.so.5
#12 0x00007fcf7a862f99 in QObject::event(QEvent*) () from /usr/lib64/libQt5Core.so.5
#13 0x00007fcf7ade49ac in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#14 0x00007fcf7adec151 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#15 0x00007fcf7a836018 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#16 0x00007fcf7a8387f0 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib64/libQt5Core.so.5
#17 0x00007fcf7a88786a in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#18 0x00007fcf637fe8dd in QUnixEventDispatcherQPA::processEvents (this=<optimized out>, flags=...) at eventdispatchers/qunixeventdispatcher.cpp:68
#19 0x00007fcf7a833fca in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#20 0x00007fcf7a83c8bc in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#21 0x0000000000408d25 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kwin-5.6.90git~20160704T143735~2b5747d/main_wayland.cpp:736




Reproducible: Always
Comment 1 Martin Flöser 2016-07-13 06:24:51 UTC
The actual problem is that we don't even support switching the backend yet and will never support that on Wayland for the running session. It should not be possible to restart the compositor.
Comment 2 Martin Flöser 2016-07-15 12:18:34 UTC
(In reply to Martin Gräßlin from comment #1)
> The actual problem is that we don't even support switching the backend yet
> and will never support that on Wayland for the running session. It should
> not be possible to restart the compositor.

actually that's nonesense. We need to be able to survive a restart of the compositor. That's needed for handleGraphicsReset in OpenGL compositor.
Comment 3 Martin Flöser 2016-07-15 14:09:02 UTC
Patch against master (due to newer test only in master branch): https://phabricator.kde.org/D2185

Will backport the part without the patch also to Plasma/5.7 branch.
Comment 4 Martin Flöser 2016-07-21 06:11:41 UTC
Git commit 3308f359848fc193b3c9d222179bc58136bea834 by Martin Gräßlin.
Committed on 21/07/2016 at 06:11.
Pushed by graesslin into branch 'master'.

Handle restart of Compositor Scene correctly for Wayland client

Summary:
This change ensures that KWin doesn't crash in the QPainter scene if
the compositor gets restarted and if there are Wayland clients.

Test Plan:
Test case added to scene qpainter which triggers a restart
of the Compositor with a window being shown. Verifies that rendering
is correct afterwards.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2185

M  +53   -0    autotests/integration/scene_qpainter_test.cpp
M  +7    -0    composite.cpp

http://commits.kde.org/kwin/3308f359848fc193b3c9d222179bc58136bea834
Comment 5 Martin Flöser 2016-07-21 06:20:08 UTC
Git commit 0286882b3f80b3b68f904dc5d6721e0da640712a by Martin Gräßlin.
Committed on 21/07/2016 at 06:13.
Pushed by graesslin into branch 'Plasma/5.7'.

Handle restart of Compositor Scene correctly for Wayland client

Summary:
This change ensures that KWin doesn't crash in the QPainter scene if
the compositor gets restarted and if there are Wayland clients.

Cherry-picked from master
FIXED-IN: 5.7.3

Test Plan:
Test case added to scene qpainter which triggers a restart
of the Compositor with a window being shown. Verifies that rendering
is correct afterwards.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2185

M  +7    -0    composite.cpp

http://commits.kde.org/kwin/0286882b3f80b3b68f904dc5d6721e0da640712a