kwin/autotests/integration
Vlad Zagorodniy 826b9742e9 wayland: Terminate client connections before Workspace is destroyed
Summary:
When ShellClient tears down, it needs to access RuleBook in order to
discard temporary rules. The problem is that WaylandServer outlives
Workspace and therefore so does ShellClient.

We can't guard against the case when RuleBook::self() is nullptr as it
is vital to discard temporary rules.

This change adjusts termination sequence so all shell clients are
destroyed before Workspace(and thus RuleBook) is gone.

ASAN output:
    ==19922==ERROR: AddressSanitizer: heap-use-after-free on address 0x606000142060 at pc 0x7fbc0fb878bb bp 0x7ffd7d464520 sp 0x7ffd7d464518
    READ of size 8 at 0x606000142060 thread T0
        #0 0x7fbc0fb878ba in QList<KWin::Rules*>::detach() /usr/include/qt5/QtCore/qlist.h:172
        #1 0x7fbc0fb8538d in QList<KWin::Rules*>::begin() /usr/include/qt5/QtCore/qlist.h:324
        #2 0x7fbc0fb808b6 in KWin::RuleBook::discardUsed(KWin::AbstractClient*, bool) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/rules.cpp:1144
        #3 0x7fbc0fe36e32 in KWin::ShellClient::destroyClient() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/shell_client.cpp:435
        #4 0x7fbc0fe7a726 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KWin::ShellClient::*)()>::call(void (KWin::ShellClient::*)(), KWin::ShellClient*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
        #5 0x7fbc0fe784c3 in void QtPrivate::FunctionPointer<void (KWin::ShellClient::*)()>::call<QtPrivate::List<>, void>(void (KWin::ShellClient::*)(), KWin::ShellClient*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
        #6 0x7fbc0fe74de9 in QtPrivate::QSlotObject<void (KWin::ShellClient::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (/home/jenkins/install-prefix/lib64/libkwin.so.5+0x1677de9)
        #7 0x7fbc04f27357 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b3357)
        #8 0x7fbc074e1970 in KWayland::Server::Resource::unbound() /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/build/src/server/KF5WaylandServer_autogen/EWIEGA46WW/moc_resource.cpp:142
        #9 0x7fbc0766b4b4 in KWayland::Server::Resource::Private::unbind(wl_resource*) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/resource.cpp:68
        #10 0x7fbc00bdc2ae  (/usr/lib64/libwayland-server.so.0+0x92ae)
        #11 0x7fbc00bdc32f in wl_resource_destroy (/usr/lib64/libwayland-server.so.0+0x932f)
        #12 0x7fbc0766b53f in KWayland::Server::Resource::Private::resourceDestroyedCallback(wl_client*, wl_resource*) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/resource.cpp:76
        #13 0x7fbbff481d8c  (/usr/lib64/libffi.so.7+0x6d8c)
        #14 0x7fbbff481179  (/usr/lib64/libffi.so.7+0x6179)
        #15 0x7fbc00bdfa5f  (/usr/lib64/libwayland-server.so.0+0xca5f)
        #16 0x7fbc00bdc6d1  (/usr/lib64/libwayland-server.so.0+0x96d1)
        #17 0x7fbc00bddc71 in wl_event_loop_dispatch (/usr/lib64/libwayland-server.so.0+0xac71)
        #18 0x7fbc07541e50 in KWayland::Server::Display::Private::dispatch() /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/display.cpp:148
        #19 0x7fbc075432de in KWayland::Server::Display::dispatchEvents(int) /home/jenkins/workspace/Administration/Dependency Build Plasma kf5-qt5 SUSEQt5.12/kwayland/src/server/display.cpp:220
        #20 0x7fbc0fe864ca in KWin::WaylandServer::dispatch() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/wayland_server.cpp:616
        #21 0x451ce0 in KWin::WaylandTestApplication::~WaylandTestApplication() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/kwin_wayland_test.cpp:91
        #22 0x42faa1 in main /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/globalshortcuts_test.cpp:381
        #23 0x7fbc04796bca in __libc_start_main (/lib64/libc.so.6+0x26bca)
        #24 0x413ea9 in _start (/home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/bin/testGlobalShortcuts+0x413ea9)

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22821
2019-07-31 20:08:50 +03:00
..
data
effects Use more accurate name for Workspace::getMovingClient method 2019-04-22 11:12:22 +03:00
fakes
helper Run clang-tidy with modernize-use-override check 2019-07-22 20:03:22 +03:00
scripting
activities_test.cpp
buffer_size_change_test.cpp Remove unnecessary flushs in new buffer size change test 2019-02-21 23:42:47 +01:00
CMakeLists.txt [autotests] Test placement strategies 2019-07-10 18:41:42 +01:00
colorcorrect_nightcolor_test.cpp [colorcorrection] Add "Constant" mode 2019-07-22 00:30:39 +03:00
dbus_interface_test.cpp Port window specific rules dialog to DBus 2018-12-31 07:58:12 +01:00
debug_console_test.cpp Run clang-tidy with modernize-use-override check 2019-07-22 20:03:22 +03:00
decoration_input_test.cpp [autotests] Fix decoration input test 2019-06-07 14:48:45 +02:00
desktop_window_x11_test.cpp
dont_crash_aurorae_destroy_deco.cpp [autotests] Don't check whether there is a /dev/dri/card0 2019-01-12 07:36:28 +01:00
dont_crash_cancel_animation.cpp
dont_crash_cursor_physical_size_empty.cpp [autotests] Update tests to use stable version of xdg-shell 2019-01-20 13:52:30 +02:00
dont_crash_empty_deco.cpp [autotests] Don't check whether there is a /dev/dri/card0 2019-01-12 07:36:28 +01:00
dont_crash_glxgears.cpp [autotests] Fix remaining autotests with failing border calculation 2019-06-27 13:44:03 +02:00
dont_crash_no_border.cpp [autotests] Update tests to use stable version of xdg-shell 2019-01-20 13:52:30 +02:00
dont_crash_reinitialize_compositor.cpp Partly remove Compositor restart functionality 2019-07-04 15:31:40 +02:00
dont_crash_useractions_menu.cpp
generic_scene_opengl_test.cpp Partly remove Compositor restart functionality 2019-07-04 15:31:40 +02:00
generic_scene_opengl_test.h
globalshortcuts_test.cpp
idle_inhibition_test.cpp [wayland] Don't honor the idle inhibitor object if the surface is not visible 2019-01-11 15:14:16 +02:00
input_stacking_order.cpp
internal_window.cpp Run clang-tidy with modernize-use-override check 2019-07-22 20:03:22 +03:00
keyboard_layout_test.cpp
keymap_creation_failure_test.cpp
kwin_wayland_test.cpp wayland: Terminate client connections before Workspace is destroyed 2019-07-31 20:08:50 +03:00
kwin_wayland_test.h Use more traditional doxygen style 2019-07-29 22:06:19 +03:00
kwinbindings_test.cpp
lockscreen.cpp Run clang-tidy with modernize-use-override check 2019-07-22 20:03:22 +03:00
maximize_test.cpp [autotests] Test placement strategies 2019-07-10 18:41:42 +01:00
modifier_only_shortcut_test.cpp Run clang-tidy with modernize-use-override check 2019-07-22 20:03:22 +03:00
move_resize_window_test.cpp autotests: Register Deleted in MoveResizeWindowTest 2019-07-30 22:08:28 +03:00
no_global_shortcuts_test.cpp Use more traditional doxygen style 2019-07-29 22:06:19 +03:00
no_xdg_runtime_dir_test.cpp
placement.cpp [autotests] Test placement strategies 2019-07-10 18:41:42 +01:00
plasma_surface_test.cpp Support CriticalNotification type and place it in a CriticalNotificationLayer 2019-05-02 10:29:38 +02:00
plasmawindow_test.cpp Run clang-tidy with modernize-use-override check 2019-07-22 20:03:22 +03:00
platformcursor.cpp
pointer_constraints_test.cpp [autotests] Update tests to use stable version of xdg-shell 2019-01-20 13:52:30 +02:00
pointer_input.cpp Run clang-tidy with modernize-use-override check 2019-07-22 20:03:22 +03:00
quick_tiling_test.cpp autotests: Port QSignalSpies to new connect syntax 2019-07-29 22:59:12 +03:00
scene_opengl_es_test.cpp
scene_opengl_shadow_test.cpp [autotests] Don't check whether there is a /dev/dri/card0 2019-01-12 07:36:28 +01:00
scene_opengl_test.cpp
scene_qpainter_shadow_test.cpp
scene_qpainter_test.cpp Partly remove Compositor restart functionality 2019-07-04 15:31:40 +02:00
screen_changes_test.cpp
screenedge_client_show_test.cpp
shade_test.cpp
shell_client_rules_test.cpp [wayland] Implement maximize rules 2019-07-29 20:56:30 +03:00
shell_client_test.cpp autotests: Port QSignalSpies to new connect syntax 2019-07-29 22:59:12 +03:00
showing_desktop_test.cpp
stacking_order_test.cpp [autotests] Add tests for keep-above and keep-below states 2019-01-01 17:29:14 +02:00
start_test.cpp Introduce a command line option to disable any kind of global shortcuts 2018-12-13 19:36:28 +01:00
struts_test.cpp Use more accurate name for Workspace::getMovingClient method 2019-04-22 11:12:22 +03:00
tabbox_test.cpp
test_helpers.cpp [wayland] Finish initialising ShellClient only when commited to the surface 2019-02-26 13:51:28 +00:00
touch_input_test.cpp Hide mouse cursor when interacting with touch screen 2018-12-13 18:55:46 +01:00
transient_no_input_test.cpp
transient_placement.cpp [autotests] Check the configure request sent to popups 2019-02-26 13:41:00 +00:00
virtual_desktop_test.cpp [autotests] Update tests to use stable version of xdg-shell 2019-01-20 13:52:30 +02:00
window_rules_test.cpp
window_selection_test.cpp Rework InputDeviceHandler focus tracking 2018-12-02 21:36:11 +01:00
x11_client_test.cpp Fix captions with non-BMP characters 2019-04-26 10:52:57 +02:00
xwayland_input_test.cpp [autotests] Fix remaining autotests with failing border calculation 2019-06-27 13:44:03 +02:00
xwayland_selections_test.cpp Remove X clipboard sync helper and rename its autotest 2019-02-19 12:30:43 +01:00