Bug 493921 - Assert in ~SvgItem
Summary: Assert in ~SvgItem
Status: RESOLVED FIXED
Alias: None
Product: frameworks-ksvg
Classification: Frameworks and Libraries
Component: General (show other bugs)
Version: 6.6.0
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-01 14:09 UTC by Marco Martin
Modified: 2024-12-08 22:39 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Martin 2024-10-01 14:09:06 UTC
Plasma often crashes after selecting desktop icons on an assert on the ~SvgItem destructor, due to connections still getting triggered during the destructor.

Backtrace:

#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737230536896) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737230536896) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737230536896, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff3842476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff38287f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff44fdbca in qAbort() () at ./src/corelib/global/qglobal.cpp:161
#6  0x00007ffff44f875a in qt_message_fatal<QString&> (message=..., context=<optimized out>)
    at ./src/corelib/global/qlogging.cpp:2025
#7  qt_message(QtMsgType, const QMessageLogContext &, const char *, typedef __va_list_tag __va_list_tag *)
    (msgType=msgType@entry=QtFatalMsg, context=<optimized out>, msg=<optimized out>, ap=ap@entry=0x7fffffffc890)
    at ./src/corelib/global/qlogging.cpp:374
#8  0x00007ffff44fe56d in QMessageLogger::fatal(char const*, ...) const
    (this=<optimized out>, msg=<optimized out>) at ./src/corelib/global/qlogging.cpp:889
#9  0x00007ffff44c2ce2 in qt_assert_x(char const*, char const*, char const*, int)
    (where=<optimized out>, what=<optimized out>, file=<optimized out>, line=<optimized out>)
    at ./src/corelib/global/qassert.cpp:77
#10 0x00007fff9e44f782 in QtPrivate::assertObjectType<KSvg::SvgItem>(QObject*) (o=0x555559a487a0)
    at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:129
#11 0x00007fff9e44f669 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KSvg::SvgItem::*)()>::call(void (KSvg::SvgItem::*)(), KSvg::SvgItem*, void**)
   
     (f=(void (KSvg::SvgItem::*)(class KSvg::SvgItem * const)) 0x7fff9e44c2a4 <KSvg::SvgItem::updateNeeded()>, o=0x555559a487a0, arg=0x7fffffffcb28) at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:144
#12 0x00007fff9e44f620 in QtPrivate::FunctionPointer<void (KSvg::SvgItem::*)()>::call<QtPrivate::List<>, void>(void (KSvg::SvgItem::*)(), KSvg::SvgItem*, void**)
    (f=(void (KSvg::SvgItem::*)(class KSvg::SvgItem * const)) 0x7fff9e44c2a4 <KSvg::SvgItem::updateNeeded()>, o=0x555559a487a0, arg=0x7fffffffcb28) at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:182
#13 0x00007fff9e44f51b in QtPrivate::QCallableObject<void (KSvg::SvgItem::*)(), QtPrivate::List<>, void>::impl(int,--Type <RET> for more, q to quit, c to continue without paging--
 QtPrivate::QSlotObjectBase*, QObject*, void**, bool*)
    (which=1, this_=0x555556d61150, r=0x555559a487a0, a=0x7fffffffcb28, ret=0x0)
    at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:553
#14 0x00007ffff446381b in QtPrivate::QSlotObjectBase::call(QObject*, void**)
    (a=0x7fffffffcb28, r=0x555559a487a0, this=<optimized out>, this=<optimized out>, r=<optimized out>, a=<optimized out>) at ./src/corelib/kernel/qobjectdefs_impl.h:469
#15 doActivate<false>(QObject*, int, void**) (sender=0x7fffe40175e0, signal_index=3, argv=0x7fffffffcb28)
    at ./src/corelib/kernel/qobject.cpp:4086
#16 0x00007ffff6a61751 in KSvg::Svg::repaintNeeded() (this=0x7fffe40175e0)
    at /home/diau/kf6/build/ksvg/src/ksvg/KF6Svg_autogen/include/moc_svg.cpp:620
#17 0x00007ffff6a6070e in KSvg::Svg::clearColorOverrides() (this=0x7fffe40175e0)
    at /home/diau/kf6/src/ksvg/src/ksvg/svg.cpp:1153
#18 0x00007fff9e44b0f4 in operator()() const (__closure=0x555558b4d560)
    at /home/diau/kf6/src/ksvg/src/declarativeimports/svgitem.cpp:60
#19 0x00007fff9e44d575 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, KSvg::SvgItem::componentComplete()::<lambda()> >::call(struct {...} &, void **) (f=..., arg=0x7fffffffcda8)
    at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:137
#20 0x00007fff9e44d50f in QtPrivate::FunctorCallable<KSvg::SvgItem::componentComplete()::<lambda()> >::call<QtPrivate::List<>, void>(struct {...} &, void *, void **) (f=..., arg=0x7fffffffcda8)
    at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:345
#21 0x00007fff9e44d432 in QtPrivate::QCallableObject<KSvg::SvgItem::componentComplete()::<lambda()>, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *)
    (which=1, this_=0x555558b4d550, r=0x555559a487a0, a=0x7fffffffcda8, ret=0x0)
    at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:555
#22 0x00007ffff446381b in QtPrivate::QSlotObjectBase::call(QObject*, void**)
    (a=0x7fffffffcda8, r=0x555559a487a0, this=<optimized out>, this=<optimized out>, r=<optimized out>, a=<optimized out>) at ./src/corelib/kernel/qobjectdefs_impl.h:469
--Type <RET> for more, q to quit, c to continue without paging--
#23 doActivate<false>(QObject*, int, void**) (sender=0x5555589c45b0, signal_index=3, argv=0x7fffffffcda8) at ./src/corelib/kernel/qobject.cpp:4086
#24 0x00007fffec02d793 in Kirigami::Platform::PlatformTheme::colorsChanged() (this=0x5555589c45b0)
    at /home/diau/kf6/build/kirigami/src/platform/KirigamiPlatform_autogen/include/moc_platformtheme.cpp:531
#25 0x00007fffec02b74f in Kirigami::Platform::PlatformTheme::emitSignalsForChanges(int) (this=0x5555589c45b0, changes=63) at /home/diau/kf6/src/kirigami/src/platform/platformtheme.cpp:888
#26 0x00007fffec02c3c5 in Kirigami::Platform::PlatformThemeChangeTracker::~PlatformThemeChangeTracker() (this=0x7fffffffcee0, __in_chrg=<optimized out>)
    at /home/diau/kf6/src/kirigami/src/platform/platformtheme.cpp:1066
#27 0x00007fffec02baf9 in Kirigami::Platform::PlatformTheme::event(QEvent*) (this=0x5555589c45b0, event=0x7fffffffd020) at /home/diau/kf6/src/kirigami/src/platform/platformtheme.cpp:950
#28 0x00007fff9e23a301 in PlasmaTheme::event(QEvent*) (this=0x5555589c45b0, event=0x7fffffffd020)
    at /home/diau/kf6/src/libplasma/src/declarativeimports/kirigamiplasmastyle/plasmatheme.cpp:148
#29 0x00007ffff680a1ab in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x5555589c45b0, e=0x7fffffffd020)
    at ./src/widgets/kernel/qapplication.cpp:3287
#30 0x00007ffff44a1dd8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x5555589c45b0, event=0x7fffffffd020) at ./src/corelib/kernel/qcoreapplication.cpp:1142
#31 0x00007fffec02bff9 in Kirigami::Platform::PlatformTheme::update() (this=0x5555589c45b0) at /home/diau/kf6/src/kirigami/src/platform/platformtheme.cpp:1007
#32 0x00007fffec03b5b4 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (Kirigami::Platform::PlatformTheme::*)()>::call(void (Kirigami::Platform::PlatformTheme::*)(), Kirigami::Platform::PlatformTheme*, void**)
    (f=(void (Kirigami::Platform::PlatformTheme::*)(class Kirigami::Platform::PlatformTheme * const)) 0x7fffec02bb16 <Kirigami::Platform::PlatformTheme::update()>, o=0x5555589c45b0, arg=0x7fffffffd250) at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:145
#33 0x00007fffec03a0ee in QtPrivate::FunctionPointer<void (Kirigami::Platform::PlatformTheme::*)()>::call<QtPrivate::List<>, void>(void (Kirigami::Platform::PlatformTheme::*)(), Kirigami::Platform::PlatformTheme*, void**)
    (f=(void (Kirigami::Platform::PlatformTheme::*)(class Kirigami::Platform::PlatformTheme * const)) 0x7fffec02bb16 <Kirigami::Platform::PlatformTheme::update()>, o=0x5555589c45b0, arg=0x7fffffffd250) at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:182
#34 0x00007fffec03838b in QtPrivate::QCallableObject<void (Kirigami::Platform::PlatformTheme::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x5555596b29f0, r=0x5555589c45b0, a=0x7fffffffd250, ret=0x0) at /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h:553
#35 0x00007ffff446381b in QtPrivate::QSlotObjectBase::call(QObject*, void**)
    (a=0x7fffffffd250, r=0x5555589c45b0, this=<optimized out>, this=<optimized out>, r=<optimized out>, a=<optimized out>) at ./src/corelib/kernel/qobjectdefs_impl.h:469
#36 doActivate<false>(QObject*, int, void**) (sender=0x555559a487a0, signal_index=15, argv=0x7fffffffd250) at ./src/corelib/kernel/qobject.cpp:4086
#37 0x00007ffff5bfa906 in QQuickItem::windowChanged(QQuickWindow*) (this=<optimized out>, _t1=<optimized out>)
    at ./obj-x86_64-linux-gnu/src/quick/Quick_autogen/include/moc_qquickitem.cpp:1407
#38 0x00007ffff5bece8d in QQuickItemPrivate::derefWindow() (this=this@entry=0x55555c0be4a0) at ./src/quick/items/qquickitem.cpp:3118
#39 0x00007ffff5bee3b6 in QQuickItem::setParentItem(QQuickItem*) (this=0x555559a487a0, parentItem=<optimized out>) at ./src/quick/items/qquickitem.cpp:2762
#40 0x00007ffff5bee861 in QQuickItem::~QQuickItem() (this=0x555559a487a0, this=<optimized out>) at ./src/quick/items/qquickitem.cpp:2380
#41 0x00007fff9e44ae95 in KSvg::SvgItem::~SvgItem() (this=0x555559a487a0, __in_chrg=<optimized out>) at /home/diau/kf6/src/ksvg/src/declarativeimports/svgitem.cpp:40
#42 0x00007fff9e44a72d in QQmlPrivate::QQmlElement<KSvg::SvgItem>::~QQmlElement() (this=0x555559a487a0, __in_chrg=<optimized out>)
    at /usr/include/x86_64-linux-gnu/qt6/QtQml/qqmlprivate.h:100
#43 0x00007fff9e44a756 in QQmlPrivate::QQmlElement<KSvg::SvgItem>::~QQmlElement() (this=0x555559a487a0, __in_chrg=<optimized out>)
    at /usr/include/x86_64-linux-gnu/qt6/QtQml/qqmlprivate.h:100
#44 0x00007ffff43fa283 in QObject::event(QEvent*) (this=0x555559a487a0, e=0x55555808ae40) at ./src/corelib/kernel/qobject.cpp:1437
#45 0x00007ffff680a1ab in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x555559a487a0, e=0x55555808ae40)
    at ./src/widgets/kernel/qapplication.cpp:3287
#46 0x00007ffff44a1dd8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x555559a487a0, event=event@entry=0x55555808ae40)
    at ./src/corelib/kernel/qcoreapplication.cpp:1142
#47 0x00007ffff44a1e1d in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=<optimized out>, event=event@entry=0x55555808ae40) at ./src/corelib/kernel/qcoreapplication.cpp:1583
#48 0x00007ffff44a2590 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x5555557764b0)
    at ./src/corelib/kernel/qcoreapplication.cpp:1940
#49 0x00007ffff42641a7 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x55555586ea60) at ./src/corelib/kernel/qeventdispatcher_glib.cpp:244
#50 0x00007ffff2d13d3b in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#51 0x00007ffff2d692b8 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#52 0x00007ffff2d113e3 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#53 0x00007ffff4262700 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55555577a740, flags=...) at ./src/corelib/kernel/qeventdispatcher_glib.cpp:394
#54 0x00007ffff44a3feb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7fffffffd7e0, flags=..., flags@entry=...) at ./src/corelib/global/qflags.h:34
#55 0x00007ffff44a5c2c in QCoreApplication::exec() () at ./src/corelib/global/qflags.h:74
#56 0x00005555555ac785 in main(int, char**) (argc=1, argv=0x7fffffffdc18) at /home/diau/kf6/src/plasma-workspace/shell/main.cpp:188
Comment 1 Marco Martin 2024-10-01 14:11:42 UTC
interesting this:

#24 0x00007fffec02d793 in Kirigami::Platform::PlatformTheme::colorsChanged() (this=0x5555589c45b0)
    at /home/diau/kf6/build/kirigami/src/platform/KirigamiPlatform_autogen/include/moc_platformtheme.cpp:531
#25 0x00007fffec02b74f in Kirigami::Platform::PlatformTheme::emitSignalsForChanges(int) (this=0x5555589c45b0, changes=63) at /home/diau/kf6/src/kirigami/src/platform/platformtheme.cpp:888

getting executed when at frame 40 there is:

#40 0x00007ffff5bee861 in QQuickItem::~QQuickItem() (this=0x555559a487a0, this=<optimized out>) at ./src/quick/items/qquickitem.cpp:2380
#41 0x00007fff9e44ae95 in KSvg::SvgItem::~SvgItem() (this=0x555559a487a0, __in_chrg=<optimized out>) at /home/diau/kf6/src/ksvg/src/declarativeimports/svgitem.cpp:40

Which explains the aeert message:

ASSERT failure in KSvg::SvgItem: "Called object is not of the correct type (class destructor may have already run)", file /usr/include/x86_64-linux-gnu/qt6/QtCore/qobjectdefs_impl.h, line 129
Comment 2 Bug Janitor Service 2024-10-01 14:22:34 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ksvg/-/merge_requests/54
Comment 3 Nicolas Fella 2024-10-20 21:43:19 UTC
similiar issue: https://bugs.kde.org/show_bug.cgi?id=495114
Comment 4 Christoph Cullmann 2024-12-08 22:39:24 UTC
Git commit 6664daab1d3d980b4cb8ab427eb18fb70c9dfd4c by Christoph Cullmann, on behalf of Marco Martin.
Committed on 08/12/2024 at 22:39.
Pushed by cullmann into branch 'master'.

Disconnect signals on destruction

Make sure to not call anything on m_svg when this is shutting down
Kirigami::PlatformTheme will lose its window at that point so will
emit colorschanged, which we shouldn't react to during destructor.

This fixes an assert
Related: bug 495114

M  +4    -0    src/declarativeimports/svgitem.cpp

https://invent.kde.org/frameworks/ksvg/-/commit/6664daab1d3d980b4cb8ab427eb18fb70c9dfd4c