Bug 511028

Summary: Plasma hangs when clicking a date in the calendar view after a long wheel scroll whose animation hasn't finished yet
Product: [Plasma] plasmashell Reporter: Ivan <2917822657>
Component: Digital Clock widgetAssignee: Plasma Bugs List <plasma-bugs-null>
Status: CONFIRMED ---    
Severity: major CC: dipesh, nate
Priority: HI Keywords: efficiency-and-performance
Version First Reported In: 6.4.5   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: the video
backtrace full

Description Ivan 2025-10-24 15:47:55 UTC
Instead of crashing, the whole desktop session freezes: mouse cursor still moves, but panels and window decoration stop reacting. The freeze occurs only if I click the date label while the calendar is still “coasting” after a rapid wheel-scroll; waiting until the scroll animation finishes avoids the hang.

Steps to reproduce(You may need to try it several times):
1.Add the default “Digital Clock” widget to any panel.
2.Hover the mouse over the date part (below the time).
3.Scroll the wheel quickly to spin through several months.
4.While the kinetic scroll animation is still running, left-click the date label.

Here are the output of "sudo journalctl -f":
10月 24 23:40:38 archlinux plasmashell[1925]: qrc:/qt/qml/org/kde/plasma/workspace/calendar/InfiniteList.qml:1900823904: RangeError: Maximum call stack size exceeded.
10月 24 23:40:38 archlinux plasmashell[1925]: qrc:/qt/qml/org/kde/plasma/workspace/calendar/InfiniteList.qml:1900824176: RangeError: Maximum call stack size exceeded.
10月 24 23:40:38 archlinux plasmashell[1925]: qrc:/qt/qml/org/kde/plasma/workspace/calendar/InfiniteList.qml:1900824176: RangeError: Maximum call stack size exceeded.
10月 24 23:40:38 archlinux plasmashell[1925]: qrc:/qt/qml/org/kde/plasma/workspace/calendar/InfiniteList.qml:1900823616: RangeError: Maximum call stack size exceeded.
10月 24 23:40:41 archlinux plasmashell[1925]: qrc:/qt/qml/org/kde/plasma/workspace/calendar/InfiniteList.qml:1900823904: RangeError: Maximum call stack size exceeded.
10月 24 23:40:41 archlinux plasmashell[1925]: qrc:/qt/qml/org/kde/plasma/workspace/calendar/InfiniteList.qml:1900823616: RangeError: Maximum call stack size exceeded.
Comment 1 Nate Graham 2025-10-24 16:30:35 UTC
This is fixed in Plasma 6.5.
Comment 2 Ivan 2025-10-31 16:24:22 UTC
(In reply to Nate Graham from comment #1)
> This is fixed in Plasma 6.5.

well,it still work in Plasma 6.5.I try it today.
Comment 3 Nate Graham 2025-10-31 20:42:48 UTC
Can you attach a screen recording that shows it happening?
Comment 4 Ivan 2025-11-09 06:03:39 UTC
Created attachment 186631 [details]
the video

look at this video
Comment 5 Bug Janitor Service 2025-11-24 03:46:19 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Nate Graham 2025-12-08 23:39:22 UTC
Thanks, I can reproduce the issue now.
Comment 7 Nate Graham 2025-12-08 23:39:42 UTC
I don't have an amazing backtrace, but it's hung somewhere in the style:

Using host libthread_db library "/usr/lib/libthread_db.so.1".
0x00007ff496a80cf1 in QObjectPrivate::connectImpl(QObject const*, int, QObject const*, void**, QtPrivate::QSlotObjectBase*, int, int const*, QMetaObject const*) () from /usr/lib/libQt6Core.so.6
(gdb) bt
#0  0x00007ff496a80cf1 in QObjectPrivate::connectImpl(QObject const*, int, QObject const*, void**, QtPrivate::QSlotObjectBase*, int, int const*, QMetaObject const*) () at /usr/lib/libQt6Core.so.6
#1  0x00007ff496a81011 in QObject::connectImpl(QObject const*, void**, QObject const*, void**, QtPrivate::QSlotObjectBase*, Qt::ConnectionType, int const*, QMetaObject const*) ()
    at /usr/lib/libQt6Core.so.6
#2  0x00007ff467048f86 in ??? ()
    at /usr/lib/qt6/plugins/kf6/kirigami/platform/KirigamiPlasmaStyle.so
#3  0x00007ff46704a1b9 in ??? ()
    at /usr/lib/qt6/plugins/kf6/kirigami/platform/KirigamiPlasmaStyle.so
#4  0x00007ff46704a3eb in ??? ()
    at /usr/lib/qt6/plugins/kf6/kirigami/platform/KirigamiPlasmaStyle.so
#5  0x00007ff48c2b44a7 in Kirigami::Platform::PlatformTheme::qmlAttachedProperties(QObject*) ()
    at /usr/lib/libKirigamiPlatform.so.6
#6  0x00007ff497d57eca in qmlAttachedPropertiesObject(QObject*, QObject* (*)(QObject*), bool) ()
    at /usr/lib/libQt6Qml.so.6
#7  0x00007ff497eba9cd in QV4::QQmlTypeWrapper::virtualGet(QV4::Managed const*, QV4::PropertyKey, QV4::Value const*, bool*) () at /usr/lib/libQt6Qml.so.6
#8  0x00007ff497c9f234 in QV4::Lookup::getterFallback(QV4::Lookup*, QV4::ExecutionEngine*, QV4::Value const&) () at /usr/lib/libQt6Qml.so.6
#9  0x00007ff447d5628f in ??? ()
#10 0x00007ffce6b7b240 in ??? ()
#11 0x0000555d2f3e9450 in ??? ()
#12 0x0000000000000000 in ??? ()

Will update once I get a better one.
Comment 8 Sebastian Sauer 2025-12-29 10:46:31 UTC
Created attachment 188056 [details]
backtrace full

Attaching full backtrace.
Comment 9 Sebastian Sauer 2025-12-29 10:51:22 UTC
From the attached backtrace:

> #0  0x00007fff6f09c14c in QObjectPrivate::connectImpl
>     (sender=sender@entry=0x5556001d0f00, signal_index=24, receiver=receiver@entry=0x5556103b70c0, slot=slot@entry=0x7ffffd12e870, slotObjRaw=slotObjRaw@entry=0x5556103b8690, type=type@entry=128, types=types@entry=0x0, senderMetaObject=senderMetaObject@entry=0x7fff710890a8 <QQuickWindow::staticMetaObject>)
>     at /home/kde/kde/src/qtbase/src/corelib/kernel/qobject.cpp:5322

```
QMetaObject::Connection QObjectPrivate::connectImpl(...)
{
    if (c2->receiver.loadRelaxed() == receiver && c2->isSlotObject && c2->slotObj->compare(slot))
}
```

> #3  PlasmaTheme::syncWindow (this=0x5556103b70c0) at /home/kde/kde/src/libplasma/src/declarativeimports/kirigamiplasmastyle/plasmatheme.cpp:98

```
void PlasmaTheme::syncWindow()
{
    connect(qw, &QQuickWindow::sceneGraphInitialized, this, &PlasmaTheme::syncWindow, Qt::UniqueConnection);
}
```

> #4  0x00007fff456e771c in PlasmaTheme::PlasmaTheme (this=this@entry=0x5556103b70c0, parent=0x5556103b6840)
>     at /home/kde/kde/src/libplasma/src/declarativeimports/kirigamiplasmastyle/plasmatheme.cpp:56

```
PlasmaTheme::PlasmaTheme(QObject *parent)
{
    syncWindow();
}
```

Getting context:

```
git blame plasmatheme.cpp | grep sceneGraphInitialized
f40f745993 (Marco Martin             2025-03-24 14:09:54 +0000  98)             connect(qw, &QQuickWindow::sceneGraphInitialized, this, &PlasmaTheme::syncWindow, Qt::UniqueConnection);

git log f40f745993^..f40f745993
commit f40f7459938667e8c66bb0585d8df5957a59a979
Author: Marco Martin <notmart@gmail.com>
Date:   Mon Mar 24 14:09:54 2025 +0000

    Use Disabled Text color when needed
    
    With the same logic taken 1:1 from the plugin in qqc2-desktop-style,
    notice when the parent item or window is disabled, and change the text
    color accordingly
    
    BUG:501633
```

Comparing with qqc2-desktop-style I came up with:

```
diff --git a/src/declarativeimports/kirigamiplasmastyle/plasmatheme.cpp b/src/declarativeimports/kirigamiplasmastyle/plasmatheme.cpp
index 1897a9344..dc230e2b6 100644
--- a/src/declarativeimports/kirigamiplasmastyle/plasmatheme.cpp
+++ b/src/declarativeimports/kirigamiplasmastyle/plasmatheme.cpp
@@ -94,8 +94,12 @@ void PlasmaTheme::syncWindow()
         if (!window) {
             window = qw;
         }
-        if (qw) {
-            connect(qw, &QQuickWindow::sceneGraphInitialized, this, &PlasmaTheme::syncWindow, Qt::UniqueConnection);
+
+        disconnect(m_sgConnection);
+        if (qw && !qw->isSceneGraphInitialized() && qw != m_window) {
+            m_sgConnection = connect(qw, &QQuickWindow::sceneGraphInitialized, this, &PlasmaTheme::syncWindow);
+        } else if (!qw) {
+            m_sgConnection = QMetaObject::Connection();
         }
     }
     m_window = window;
diff --git a/src/declarativeimports/kirigamiplasmastyle/plasmatheme.h b/src/declarativeimports/kirigamiplasmastyle/plasmatheme.h
index 462c8713d..ca645f326 100644
--- a/src/declarativeimports/kirigamiplasmastyle/plasmatheme.h
+++ b/src/declarativeimports/kirigamiplasmastyle/plasmatheme.h
@@ -38,6 +38,7 @@ protected:
 private:
     Plasma::Theme m_theme;
     QPointer<QWindow> m_window;
+    QMetaObject::Connection m_sgConnection;
 };
 
 #endif // PLASMATHEME_H
```

Unfortunately even with that patch applied the freeze still happens but now the backtrace looks very strange :-/