Bug 433308

Summary: KDE, Wayland, Qt Mouse Focus Malfunction, then System Settings Crash
Product: [Applications] systemsettings Reporter: Robert Webb <ro.webbdg>
Component: generic-crashAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED UPSTREAM    
Severity: crash CC: bugseforuns, kde, nate, ro.webbdg, woddy68
Priority: NOR Keywords: wayland
Version: 5.21.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: backtrace from System Settings crash
New crash information added by DrKonqi

Description Robert Webb 2021-02-20 09:38:39 UTC
Created attachment 135952 [details]
backtrace from System Settings crash

SUMMARY
    1. Window behavior in focus-follows-mouse mode: The focus does
    not go to the window the mouse is over, but requires clicking in
    it. (Usually.  Not 100% of the time.)  This is new behavior,
    since the latest software update.  It was working before.

    2. System Settings crashes: After changing the focus mode setting.

STEPS TO REPRODUCE
    1. On the Plasma, Wayland desktop, open System Settings and
    navigate to 'Window Behavior', Focus tab.

    2. Select a different focus mode.

    3. Click 'Apply'.  System Settings will crash.

    4. Any time focus-follows-mouse mode is in effect, it will not
    function correctly.

OBSERVED RESULT
    System Settings crashes, but the setting change does take effect.

EXPECTED RESULT
    Focus following the mouse, when that mode is selected.
    No crash, duh.

SOFTWARE/OS VERSIONS
    System Settings version: 5.21.0
    Kernel: Linux 5.10.16-1-default #1 x86_64
    Operating System: openSUSE Tumbleweed 20210217
    KDE Plasma Version: 5.21.0
    KDE Frameworks Version: 5.79.0
    Qt Version: 5.15.2
    Kernel Version: 5.10.16-1-default
    OS Type: 64-bit
    Graphics Platform: Wayland

CHRONOLOGY
    * Regular boot from power-up.  Login (KDE, Wayland).  My saved
    session has two Konsole windows open, with a third in another
    workspace.

    * The focus is not following the mouse.  I have to click in a
    window or the desktop to change the focus, although at first,
    it was changing sometimes with just mouse movement over a window.

      * My existing focus settings, which had previously been working
      fine:

      CONFIGURATION
        Focus follows mouse (mouse precedence)
        Delay focus by: 300 ms
        Focus stealing prevention: Low
        Raising windows: [X] Click raises active window

    * Opened System Settings.  The focus setting had not changed.
    I selected each of the focus settings to read their descriptions in
    turn, but finally left it as it had been, and never clicked 'Apply'.
    Closed System Settings.

    * Clicks were still needed to change focus.  Opened System Settings
    again.  Selected the 'Focus strictly...' focus setting, clicked
    'Apply', and it crashed.

Crash 1:
Executable: systemsettings5 PID: 2238 Signal: Segmentation fault (11) Time: 2/17/21 1:50:04 PM PST

    * Now, after the crash, with the debug and help windows additionally
    open, the focus is behaving well, always to the window the mouse
    is over, after a short delay.

    * Installed debug symbols.  Restarted System Settings.  The
    "strictly" setting was remembered.  To try repeating the fail
    sequence, I set 'Focus follows mouse (mouse precedence)', and
    clicked 'Apply'.  System Settings crashed again.  The original
    focus problem was back: Clicking was required to change focus,
    except that sometimes focus would shift with just mouse movement.
    So, back to the original setting and the original problem.

    * The "Bug reporting assistant", or whatever it is called, of drkonqi
    crashed with the very first character I typed into the text field.

    * Repeated the crash multiple times, eventually with no saved session
    (no other windows open), just logging in, opening System Settings
    > Window Behavior > Focus Tab, changing the focus style setting,
    clicking 'Apply', and *crash*.

    * I have been able to use System Settings for other things without
    problem, for instance, changing to start with an empty session,
    changing the workspace change style, window close style, sound
    alerts, etc.  But changing that focus style crashes it every time.
    I have tried alternating between the two click-to-focus styles,
    and between the focus-follows-mouse and focus-strictly-to-mouse
    settings.  Even though System Settings would crash, the setting
    would get changed.

    * Independent of System Settings, the 'Focus follows mouse (mouse
    precedence)' mode does not work.  Most of the time, it requires
    clicking to change focus.

3rd saved crash (backtrace attached):
Executable: systemsettings5 PID: 2271 Signal: Segmentation fault (11) Time: 2/19/21 4:03:38 AM PST

    * I have three backtraces, from the first crash, another, and the
    latest.  They are all identical, ignoring the hexadecimal numbers,
    and the PID.

ADDITIONAL INFORMATION
    * A web search for
    "QWaylandClientExtensionPrivate::handleRegistryGlobal", the function
    at the top of the trace, showed a bug from several years ago at
    the same line number (67) of 'global/qwaylandclientextension.cpp'
    as identified in the trace.  Did the bug come back to life?

    Thank you.
Comment 1 Nate Graham 2021-02-22 23:29:20 UTC
Application: System Settings (systemsettings5), signal: Segmentation fault

[KCrash Handler]
#4  0x0000000072e67230 in ?? ()
#5  0x00007fab921f3893 in QWaylandClientExtensionPrivate::handleRegistryGlobal (data=0x5631ca0c7210, registry=0x5631c98fae40, id=45, interface=..., version=1) at global/qwaylandclientextension.cpp:67
#6  0x00007fab921dc4b2 in QtWaylandClient::QWaylandDisplay::registry_global (this=<optimized out>, id=45, interface=..., version=1) at qwaylanddisplay.cpp:396
#7  0x00007fab921fcc56 in QtWayland::wl_registry::handle_global (data=0x5631c98f6ce0, object=<optimized out>, name=45, interface=0x5631cfa8a7a0 "org_kde_kwin_blur_manager", version=1) at qwayland-wayland.cpp:94
#8  0x00007fab9180442d in ffi_call_unix64 () at ../src/x86/unix64.S:106
#9  0x00007fab918004f9 in ffi_call_int (cif=<optimized out>, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=<optimized out>) at ../src/x86/ffi64.c:669
#10 0x00007fab921528fe in wl_closure_invoke (closure=closure@entry=0x5631cfa8a6c0, target=<optimized out>, target@entry=0x5631c98fae40, opcode=opcode@entry=0, data=<optimized out>, flags=<optimized out>) at src/connection.c:1018
#11 0x00007fab92152fcb in dispatch_event (display=0x5631c98facf0, queue=<optimized out>, queue=<optimized out>) at src/wayland-client.c:1452
#12 0x00007fab9215319c in dispatch_queue (queue=0x5631c98fadc0, display=0x5631c98facf0) at src/wayland-client.c:1598
#13 wl_display_dispatch_queue_pending (display=0x5631c98facf0, queue=0x5631c98fadc0) at src/wayland-client.c:1840
#14 0x00007fab921531ec in wl_display_dispatch_pending (display=<optimized out>) at src/wayland-client.c:1903
#15 0x00007fab921dbdf3 in QtWaylandClient::QWaylandDisplay::flushRequests (this=0x5631c98f6cd0) at qwaylanddisplay.cpp:221
#16 0x00007fab94743980 in doActivate<false> (sender=0x5631c9935a60, signal_index=3, argv=argv@entry=0x7ffece72eee0) at kernel/qobject.cpp:3898
#17 0x00007fab9473cc60 in QMetaObject::activate (sender=sender@entry=0x5631c9935a60, m=m@entry=0x7fab949f1a60 <QSocketNotifier::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffece72eee0) at kernel/qobject.cpp:3946
#18 0x00007fab94746d7f in QSocketNotifier::activated (this=this@entry=0x5631c9935a60, _t1=..., _t2=<optimized out>, _t3=...) at .moc/moc_qsocketnotifier.cpp:178
#19 0x00007fab9474757b in QSocketNotifier::event (this=0x5631c9935a60, e=0x7ffece72eff0) at kernel/qsocketnotifier.cpp:302
#20 0x00007fab953ae4ff in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x5631c9935a60, e=0x7ffece72eff0) at kernel/qapplication.cpp:3632
#21 0x00007fab9470d32a in QCoreApplication::notifyInternal2 (receiver=0x5631c9935a60, event=0x7ffece72eff0) at kernel/qcoreapplication.cpp:1063
#22 0x00007fab94765475 in socketNotifierSourceDispatch (source=0x5631c9935c60) at kernel/qeventdispatcher_glib.cpp:107
#23 0x00007fab922eef27 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#24 0x00007fab922ef2a8 in ?? () from /usr/lib64/libglib-2.0.so.0
#25 0x00007fab922ef35f in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#26 0x00007fab947648bf in QEventDispatcherGlib::processEvents (this=0x5631c9935b30, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#27 0x00007fab9470bceb in QEventLoop::exec (this=this@entry=0x7ffece72f200, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#28 0x00007fab94713f60 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#29 0x00005631c94954da in main (argc=<optimized out>, argv=0x7ffece72f320) at /usr/src/debug/systemsettings5-5.21.0-1.1.x86_64/app/main.cpp:222
[Inferior 1 (process 2271) detached]
Comment 2 David Edmundson 2021-02-22 23:51:02 UTC
Must be the shortcut grabber.

In any case, is in Qt and we have a MR to fix up that bit of code
Comment 3 David Edmundson 2021-02-22 23:52:03 UTC
*** Bug 433314 has been marked as a duplicate of this bug. ***
Comment 4 Nate Graham 2021-02-23 01:02:23 UTC
What's the KDE MR and what's the URL of the Qt bug report or patch? When marking a bug as UPSTREAM, we need a URL to the upstream location so people can follow up there.
Comment 5 carlo 2021-03-06 17:37:14 UTC
Created attachment 136434 [details]
New crash information added by DrKonqi

systemsettings5 (5.21.1) using Qt 5.15.2

- What I was doing when the application crashed:

After making a change to systemsettings5 it closes instantly.

-- Backtrace (Reduced):
#5  0x00007fcf6200e893 in QWaylandClientExtensionPrivate::handleRegistryGlobal (data=0x560abc394190, registry=0x560abace11a0, id=45, interface=..., version=1) at global/qwaylandclientextension.cpp:67
#6  0x00007fcf61ff74b2 in QtWaylandClient::QWaylandDisplay::registry_global (this=<optimized out>, id=45, interface=..., version=1) at qwaylanddisplay.cpp:396
#7  0x00007fcf62017c56 in QtWayland::wl_registry::handle_global (data=0x560abacdce00, object=<optimized out>, name=45, interface=0x560abc187200 "org_kde_kwin_blur_manager", version=1) at qwayland-wayland.cpp:94
#8  0x00007fcf615e642d in ffi_call_unix64 () at ../src/x86/unix64.S:106
#9  0x00007fcf615e24f9 in ffi_call_int (cif=<optimized out>, fn=<optimized out>, rvalue=<optimized out>, avalue=<optimized out>, closure=<optimized out>) at ../src/x86/ffi64.c:669